cURL
curl -X POST \
https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {{TOKEN}}' \
-H 'Content-Type: application/json' \
-d '{
"contacts": [{
"mobile": {
"number": "+1234567890",
"country": "US"
}
}],
"template": "Congratulations! You just sent your first message"
} 'var request = require("request");
var options = { method: 'POST',
url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages',
headers:
{ 'Authorization': 'Bearer {{TOKEN}}',
Accept: 'application/json',
'Content-Type': 'application/json' },
body:
{ contacts: [ { mobile: { number: '+1234567890', country: 'US' } } ],
template: 'Congratulations! You just sent your first message' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{TOKEN}}',
'Accept' => 'application/json',
'Content-Type' => 'application/json'
));
$request->setBody('{
"contacts": [{
"mobile": {
"number": "+1234567890",
"country": "US"
}
}],
"template": "Congratulations! You just sent your first message"
} ');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}import requests
url = "https://api.sakari.io/v1/accounts/{accountId}/messages"
payload = {
"conversations": ["<string>"],
"contacts": [
{
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"lists": [
{
"name": "<string>",
"keyword": "<string>",
"doubleOptIn": {
"enabled": True,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": ["<string>"]
}
],
"list": "<string>",
"valid": True,
"invalid": True,
"blocked": True,
"unblocked": True,
"optIn": True
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": { "id": 123 },
"hubspot": { "id": 123 },
"pipedrive": { "id": 123 }
}
],
"filters": {
"tags": ["<string>"],
"attributes": [{}]
},
"phoneNumberFilter": { "group": { "id": "<string>" } },
"template": "<string>",
"media": [{ "url": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/v1/accounts/{accountId}/messages"
payload := strings.NewReader("{\n \"conversations\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"email\": \"chris@sakari.io\",\n \"firstName\": \"Chris\",\n \"lastName\": \"Bloggs\",\n \"lists\": [\n {\n \"name\": \"<string>\",\n \"keyword\": \"<string>\",\n \"doubleOptIn\": {\n \"enabled\": true,\n \"prompt\": \"<string>\"\n },\n \"filter\": {\n \"q\": \"<string>\",\n \"attributes\": [\n {\n \"attribute\": \"<string>\",\n \"comparator\": \"<string>\",\n \"value\": [\n \"<string>\"\n ]\n }\n ],\n \"list\": \"<string>\",\n \"valid\": true,\n \"invalid\": true,\n \"blocked\": true,\n \"unblocked\": true,\n \"optIn\": true\n },\n \"optInConfirmation\": \"<string>\",\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"optOut\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"attributes\": {},\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"blocked\": \"2023-11-07T05:31:56Z\",\n \"activecampaign\": {\n \"id\": 123\n },\n \"hubspot\": {\n \"id\": 123\n },\n \"pipedrive\": {\n \"id\": 123\n }\n }\n ],\n \"filters\": {\n \"tags\": [\n \"<string>\"\n ],\n \"attributes\": [\n {}\n ]\n },\n \"phoneNumberFilter\": {\n \"group\": {\n \"id\": \"<string>\"\n }\n },\n \"template\": \"<string>\",\n \"media\": [\n {\n \"url\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sakari.io/v1/accounts/{accountId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversations\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"email\": \"chris@sakari.io\",\n \"firstName\": \"Chris\",\n \"lastName\": \"Bloggs\",\n \"lists\": [\n {\n \"name\": \"<string>\",\n \"keyword\": \"<string>\",\n \"doubleOptIn\": {\n \"enabled\": true,\n \"prompt\": \"<string>\"\n },\n \"filter\": {\n \"q\": \"<string>\",\n \"attributes\": [\n {\n \"attribute\": \"<string>\",\n \"comparator\": \"<string>\",\n \"value\": [\n \"<string>\"\n ]\n }\n ],\n \"list\": \"<string>\",\n \"valid\": true,\n \"invalid\": true,\n \"blocked\": true,\n \"unblocked\": true,\n \"optIn\": true\n },\n \"optInConfirmation\": \"<string>\",\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"optOut\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"attributes\": {},\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"blocked\": \"2023-11-07T05:31:56Z\",\n \"activecampaign\": {\n \"id\": 123\n },\n \"hubspot\": {\n \"id\": 123\n },\n \"pipedrive\": {\n \"id\": 123\n }\n }\n ],\n \"filters\": {\n \"tags\": [\n \"<string>\"\n ],\n \"attributes\": [\n {}\n ]\n },\n \"phoneNumberFilter\": {\n \"group\": {\n \"id\": \"<string>\"\n }\n },\n \"template\": \"<string>\",\n \"media\": [\n {\n \"url\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/v1/accounts/{accountId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversations\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"email\": \"chris@sakari.io\",\n \"firstName\": \"Chris\",\n \"lastName\": \"Bloggs\",\n \"lists\": [\n {\n \"name\": \"<string>\",\n \"keyword\": \"<string>\",\n \"doubleOptIn\": {\n \"enabled\": true,\n \"prompt\": \"<string>\"\n },\n \"filter\": {\n \"q\": \"<string>\",\n \"attributes\": [\n {\n \"attribute\": \"<string>\",\n \"comparator\": \"<string>\",\n \"value\": [\n \"<string>\"\n ]\n }\n ],\n \"list\": \"<string>\",\n \"valid\": true,\n \"invalid\": true,\n \"blocked\": true,\n \"unblocked\": true,\n \"optIn\": true\n },\n \"optInConfirmation\": \"<string>\",\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"optOut\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"attributes\": {},\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"blocked\": \"2023-11-07T05:31:56Z\",\n \"activecampaign\": {\n \"id\": 123\n },\n \"hubspot\": {\n \"id\": 123\n },\n \"pipedrive\": {\n \"id\": 123\n }\n }\n ],\n \"filters\": {\n \"tags\": [\n \"<string>\"\n ],\n \"attributes\": [\n {}\n ]\n },\n \"phoneNumberFilter\": {\n \"group\": {\n \"id\": \"<string>\"\n }\n },\n \"template\": \"<string>\",\n \"media\": [\n {\n \"url\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"messages": [
{
"id": "<string>",
"status": "<string>",
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"contact": {
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"lists": [
{
"id": "<string>",
"name": "<string>",
"source": {
"id": "<string>",
"integration": "<string>",
"lastSynced": "<string>"
},
"keyword": "<string>",
"doubleOptIn": {
"enabled": true,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": [
"<string>"
]
}
],
"list": "<string>",
"valid": true,
"invalid": true,
"blocked": true,
"unblocked": true,
"optIn": true
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": {
"id": 123
},
"hubspot": {
"id": 123
},
"pipedrive": {
"id": 123
},
"valid": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
},
"conversation": {
"closed": "2023-11-07T05:31:56Z",
"lastMessage": "<unknown>",
"id": "<string>",
"contact": {
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"lists": [
{
"id": "<string>",
"name": "<string>",
"source": {
"id": "<string>",
"integration": "<string>",
"lastSynced": "<string>"
},
"keyword": "<string>",
"doubleOptIn": {
"enabled": true,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": [
"<string>"
]
}
],
"list": "<string>",
"valid": true,
"invalid": true,
"blocked": true,
"unblocked": true,
"optIn": true
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": {
"id": 123
},
"hubspot": {
"id": 123
},
"pipedrive": {
"id": 123
},
"valid": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
},
"phoneNumber": {
"id": "<string>",
"status": "<string>",
"number": "<string>",
"country": "<string>",
"type": "<string>",
"name": "<string>",
"verified": true,
"provider": "<string>",
"supportedDestinations": [
"<string>"
],
"forwardTo": {},
"universalReply": true,
"channels": {
"sms": {
"active": true,
"universalReply": true,
"supportedDestinations": {},
"regulatory": {
"brandStatus": "<string>",
"campaign": {
"id": "<string>",
"campaignId": "<string>",
"useCase": "<string>"
},
"pft": true,
"submitted": "2023-11-07T05:31:56Z",
"approved": "2023-11-07T05:31:56Z",
"rejected": "2023-11-07T05:31:56Z"
}
},
"voice": {
"active": true,
"incoming": {
"forwardTo": "<string>",
"message": "<string>",
"transcribe": true
},
"features": [
"<string>"
]
},
"whatsapp": {
"active": true
}
},
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"hosted": true
},
"group": {
"id": "<string>",
"name": "<string>"
},
"unread": [
"<string>"
],
"type": "<string>",
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
},
"group": {
"id": "<string>",
"name": "<string>",
"phoneNumbers?": [
{
"id": "<string>",
"status": "<string>",
"number": "<string>",
"country": "<string>",
"type": "<string>",
"name": "<string>",
"verified": true,
"provider": "<string>",
"supportedDestinations": [
"<string>"
],
"forwardTo": {},
"universalReply": true,
"channels": {
"sms": {
"active": true,
"universalReply": true,
"supportedDestinations": {},
"regulatory": {
"brandStatus": "<string>",
"campaign": {
"id": "<string>",
"campaignId": "<string>",
"useCase": "<string>"
},
"pft": true,
"submitted": "2023-11-07T05:31:56Z",
"approved": "2023-11-07T05:31:56Z",
"rejected": "2023-11-07T05:31:56Z"
}
},
"voice": {
"active": true,
"incoming": {
"forwardTo": "<string>",
"message": "<string>",
"transcribe": true
},
"features": [
"<string>"
]
},
"whatsapp": {
"active": true
}
},
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"hosted": true
}
],
"notifications": [
{
"destination": {
"id": "<string>",
"name": "<string>"
},
"integration": "<string>",
"group": {
"id": "<string>",
"name": "<string>"
}
}
],
"tags": [
"<string>"
],
"users": [
{
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"tacAccepted": "2023-11-07T05:31:56Z"
}
],
"senders": [
{
"id": "<string>",
"type": "phonenumber",
"subType": "<string>",
"status": "<string>",
"identifier": "<string>",
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"channels": {
"sms": {
"active": true,
"universalReply": true,
"supportedDestinations": {},
"regulatory": {
"brandStatus": "<string>",
"campaign": {
"id": "<string>",
"campaignId": "<string>",
"useCase": "<string>"
},
"pft": true,
"submitted": "2023-11-07T05:31:56Z",
"approved": "2023-11-07T05:31:56Z",
"rejected": "2023-11-07T05:31:56Z"
}
},
"voice": {
"active": true,
"incoming": {
"forwardTo": "<string>",
"message": "<string>",
"transcribe": true
},
"features": [
"<string>"
]
},
"whatsapp": {
"active": true
}
},
"groups": [
{
"id": "<string>",
"name": "<string>"
}
]
}
],
"officeHours": {
"active": true,
"timezone": "<string>",
"times": {
"sun": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"mon": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"tue": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"wed": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"thu": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"fri": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"sat": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
]
}
},
"isDefault": true,
"useSharedPool": true
},
"type": "<string>",
"message": "<string>",
"template": "<string>",
"outgoing": true,
"phoneNumber": "+1234567890",
"price": 123,
"segments": 123,
"read": true,
"media": [
{
"url": "<string>",
"type": "<string>",
"name": "<string>",
"filename": "<string>"
}
],
"sendAt": "2023-11-07T05:31:56Z",
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
}
],
"jobId": "<string>",
"requested": 123,
"valid": 123,
"invalid": [
{
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"lists": [
{
"id": "<string>",
"name": "<string>",
"source": {
"id": "<string>",
"integration": "<string>",
"lastSynced": "<string>"
},
"keyword": "<string>",
"doubleOptIn": {
"enabled": true,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": [
"<string>"
]
}
],
"list": "<string>",
"valid": true,
"invalid": true,
"blocked": true,
"unblocked": true,
"optIn": true
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": {
"id": 123
},
"hubspot": {
"id": 123
},
"pipedrive": {
"id": 123
},
"valid": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
}
],
"estimatedPrice": 123
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}messages
Send Messages
POST
/
v1
/
accounts
/
{accountId}
/
messages
cURL
curl -X POST \
https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {{TOKEN}}' \
-H 'Content-Type: application/json' \
-d '{
"contacts": [{
"mobile": {
"number": "+1234567890",
"country": "US"
}
}],
"template": "Congratulations! You just sent your first message"
} 'var request = require("request");
var options = { method: 'POST',
url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages',
headers:
{ 'Authorization': 'Bearer {{TOKEN}}',
Accept: 'application/json',
'Content-Type': 'application/json' },
body:
{ contacts: [ { mobile: { number: '+1234567890', country: 'US' } } ],
template: 'Congratulations! You just sent your first message' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{TOKEN}}',
'Accept' => 'application/json',
'Content-Type' => 'application/json'
));
$request->setBody('{
"contacts": [{
"mobile": {
"number": "+1234567890",
"country": "US"
}
}],
"template": "Congratulations! You just sent your first message"
} ');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}import requests
url = "https://api.sakari.io/v1/accounts/{accountId}/messages"
payload = {
"conversations": ["<string>"],
"contacts": [
{
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"lists": [
{
"name": "<string>",
"keyword": "<string>",
"doubleOptIn": {
"enabled": True,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": ["<string>"]
}
],
"list": "<string>",
"valid": True,
"invalid": True,
"blocked": True,
"unblocked": True,
"optIn": True
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": { "id": 123 },
"hubspot": { "id": 123 },
"pipedrive": { "id": 123 }
}
],
"filters": {
"tags": ["<string>"],
"attributes": [{}]
},
"phoneNumberFilter": { "group": { "id": "<string>" } },
"template": "<string>",
"media": [{ "url": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/v1/accounts/{accountId}/messages"
payload := strings.NewReader("{\n \"conversations\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"email\": \"chris@sakari.io\",\n \"firstName\": \"Chris\",\n \"lastName\": \"Bloggs\",\n \"lists\": [\n {\n \"name\": \"<string>\",\n \"keyword\": \"<string>\",\n \"doubleOptIn\": {\n \"enabled\": true,\n \"prompt\": \"<string>\"\n },\n \"filter\": {\n \"q\": \"<string>\",\n \"attributes\": [\n {\n \"attribute\": \"<string>\",\n \"comparator\": \"<string>\",\n \"value\": [\n \"<string>\"\n ]\n }\n ],\n \"list\": \"<string>\",\n \"valid\": true,\n \"invalid\": true,\n \"blocked\": true,\n \"unblocked\": true,\n \"optIn\": true\n },\n \"optInConfirmation\": \"<string>\",\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"optOut\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"attributes\": {},\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"blocked\": \"2023-11-07T05:31:56Z\",\n \"activecampaign\": {\n \"id\": 123\n },\n \"hubspot\": {\n \"id\": 123\n },\n \"pipedrive\": {\n \"id\": 123\n }\n }\n ],\n \"filters\": {\n \"tags\": [\n \"<string>\"\n ],\n \"attributes\": [\n {}\n ]\n },\n \"phoneNumberFilter\": {\n \"group\": {\n \"id\": \"<string>\"\n }\n },\n \"template\": \"<string>\",\n \"media\": [\n {\n \"url\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sakari.io/v1/accounts/{accountId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversations\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"email\": \"chris@sakari.io\",\n \"firstName\": \"Chris\",\n \"lastName\": \"Bloggs\",\n \"lists\": [\n {\n \"name\": \"<string>\",\n \"keyword\": \"<string>\",\n \"doubleOptIn\": {\n \"enabled\": true,\n \"prompt\": \"<string>\"\n },\n \"filter\": {\n \"q\": \"<string>\",\n \"attributes\": [\n {\n \"attribute\": \"<string>\",\n \"comparator\": \"<string>\",\n \"value\": [\n \"<string>\"\n ]\n }\n ],\n \"list\": \"<string>\",\n \"valid\": true,\n \"invalid\": true,\n \"blocked\": true,\n \"unblocked\": true,\n \"optIn\": true\n },\n \"optInConfirmation\": \"<string>\",\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"optOut\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"attributes\": {},\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"blocked\": \"2023-11-07T05:31:56Z\",\n \"activecampaign\": {\n \"id\": 123\n },\n \"hubspot\": {\n \"id\": 123\n },\n \"pipedrive\": {\n \"id\": 123\n }\n }\n ],\n \"filters\": {\n \"tags\": [\n \"<string>\"\n ],\n \"attributes\": [\n {}\n ]\n },\n \"phoneNumberFilter\": {\n \"group\": {\n \"id\": \"<string>\"\n }\n },\n \"template\": \"<string>\",\n \"media\": [\n {\n \"url\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/v1/accounts/{accountId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversations\": [\n \"<string>\"\n ],\n \"contacts\": [\n {\n \"email\": \"chris@sakari.io\",\n \"firstName\": \"Chris\",\n \"lastName\": \"Bloggs\",\n \"lists\": [\n {\n \"name\": \"<string>\",\n \"keyword\": \"<string>\",\n \"doubleOptIn\": {\n \"enabled\": true,\n \"prompt\": \"<string>\"\n },\n \"filter\": {\n \"q\": \"<string>\",\n \"attributes\": [\n {\n \"attribute\": \"<string>\",\n \"comparator\": \"<string>\",\n \"value\": [\n \"<string>\"\n ]\n }\n ],\n \"list\": \"<string>\",\n \"valid\": true,\n \"invalid\": true,\n \"blocked\": true,\n \"unblocked\": true,\n \"optIn\": true\n },\n \"optInConfirmation\": \"<string>\",\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"optOut\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"attributes\": {},\n \"optIn\": \"2023-11-07T05:31:56Z\",\n \"blocked\": \"2023-11-07T05:31:56Z\",\n \"activecampaign\": {\n \"id\": 123\n },\n \"hubspot\": {\n \"id\": 123\n },\n \"pipedrive\": {\n \"id\": 123\n }\n }\n ],\n \"filters\": {\n \"tags\": [\n \"<string>\"\n ],\n \"attributes\": [\n {}\n ]\n },\n \"phoneNumberFilter\": {\n \"group\": {\n \"id\": \"<string>\"\n }\n },\n \"template\": \"<string>\",\n \"media\": [\n {\n \"url\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"messages": [
{
"id": "<string>",
"status": "<string>",
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"contact": {
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"lists": [
{
"id": "<string>",
"name": "<string>",
"source": {
"id": "<string>",
"integration": "<string>",
"lastSynced": "<string>"
},
"keyword": "<string>",
"doubleOptIn": {
"enabled": true,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": [
"<string>"
]
}
],
"list": "<string>",
"valid": true,
"invalid": true,
"blocked": true,
"unblocked": true,
"optIn": true
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": {
"id": 123
},
"hubspot": {
"id": 123
},
"pipedrive": {
"id": 123
},
"valid": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
},
"conversation": {
"closed": "2023-11-07T05:31:56Z",
"lastMessage": "<unknown>",
"id": "<string>",
"contact": {
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"lists": [
{
"id": "<string>",
"name": "<string>",
"source": {
"id": "<string>",
"integration": "<string>",
"lastSynced": "<string>"
},
"keyword": "<string>",
"doubleOptIn": {
"enabled": true,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": [
"<string>"
]
}
],
"list": "<string>",
"valid": true,
"invalid": true,
"blocked": true,
"unblocked": true,
"optIn": true
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": {
"id": 123
},
"hubspot": {
"id": 123
},
"pipedrive": {
"id": 123
},
"valid": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
},
"phoneNumber": {
"id": "<string>",
"status": "<string>",
"number": "<string>",
"country": "<string>",
"type": "<string>",
"name": "<string>",
"verified": true,
"provider": "<string>",
"supportedDestinations": [
"<string>"
],
"forwardTo": {},
"universalReply": true,
"channels": {
"sms": {
"active": true,
"universalReply": true,
"supportedDestinations": {},
"regulatory": {
"brandStatus": "<string>",
"campaign": {
"id": "<string>",
"campaignId": "<string>",
"useCase": "<string>"
},
"pft": true,
"submitted": "2023-11-07T05:31:56Z",
"approved": "2023-11-07T05:31:56Z",
"rejected": "2023-11-07T05:31:56Z"
}
},
"voice": {
"active": true,
"incoming": {
"forwardTo": "<string>",
"message": "<string>",
"transcribe": true
},
"features": [
"<string>"
]
},
"whatsapp": {
"active": true
}
},
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"hosted": true
},
"group": {
"id": "<string>",
"name": "<string>"
},
"unread": [
"<string>"
],
"type": "<string>",
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
},
"group": {
"id": "<string>",
"name": "<string>",
"phoneNumbers?": [
{
"id": "<string>",
"status": "<string>",
"number": "<string>",
"country": "<string>",
"type": "<string>",
"name": "<string>",
"verified": true,
"provider": "<string>",
"supportedDestinations": [
"<string>"
],
"forwardTo": {},
"universalReply": true,
"channels": {
"sms": {
"active": true,
"universalReply": true,
"supportedDestinations": {},
"regulatory": {
"brandStatus": "<string>",
"campaign": {
"id": "<string>",
"campaignId": "<string>",
"useCase": "<string>"
},
"pft": true,
"submitted": "2023-11-07T05:31:56Z",
"approved": "2023-11-07T05:31:56Z",
"rejected": "2023-11-07T05:31:56Z"
}
},
"voice": {
"active": true,
"incoming": {
"forwardTo": "<string>",
"message": "<string>",
"transcribe": true
},
"features": [
"<string>"
]
},
"whatsapp": {
"active": true
}
},
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"hosted": true
}
],
"notifications": [
{
"destination": {
"id": "<string>",
"name": "<string>"
},
"integration": "<string>",
"group": {
"id": "<string>",
"name": "<string>"
}
}
],
"tags": [
"<string>"
],
"users": [
{
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"tacAccepted": "2023-11-07T05:31:56Z"
}
],
"senders": [
{
"id": "<string>",
"type": "phonenumber",
"subType": "<string>",
"status": "<string>",
"identifier": "<string>",
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"channels": {
"sms": {
"active": true,
"universalReply": true,
"supportedDestinations": {},
"regulatory": {
"brandStatus": "<string>",
"campaign": {
"id": "<string>",
"campaignId": "<string>",
"useCase": "<string>"
},
"pft": true,
"submitted": "2023-11-07T05:31:56Z",
"approved": "2023-11-07T05:31:56Z",
"rejected": "2023-11-07T05:31:56Z"
}
},
"voice": {
"active": true,
"incoming": {
"forwardTo": "<string>",
"message": "<string>",
"transcribe": true
},
"features": [
"<string>"
]
},
"whatsapp": {
"active": true
}
},
"groups": [
{
"id": "<string>",
"name": "<string>"
}
]
}
],
"officeHours": {
"active": true,
"timezone": "<string>",
"times": {
"sun": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"mon": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"tue": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"wed": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"thu": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"fri": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
],
"sat": [
{
"start": {
"hour": 123,
"minute": 123
},
"end": {
"hour": 123,
"minute": 123
}
}
]
}
},
"isDefault": true,
"useSharedPool": true
},
"type": "<string>",
"message": "<string>",
"template": "<string>",
"outgoing": true,
"phoneNumber": "+1234567890",
"price": 123,
"segments": 123,
"read": true,
"media": [
{
"url": "<string>",
"type": "<string>",
"name": "<string>",
"filename": "<string>"
}
],
"sendAt": "2023-11-07T05:31:56Z",
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
}
],
"jobId": "<string>",
"requested": 123,
"valid": 123,
"invalid": [
{
"id": "<string>",
"email": "chris@sakari.io",
"firstName": "Chris",
"lastName": "Bloggs",
"mobile": {
"country": "<string>",
"number": "123-456-7890",
"verified": "2023-11-07T05:31:56Z",
"valid": true,
"lineType": "mobile"
},
"lists": [
{
"id": "<string>",
"name": "<string>",
"source": {
"id": "<string>",
"integration": "<string>",
"lastSynced": "<string>"
},
"keyword": "<string>",
"doubleOptIn": {
"enabled": true,
"prompt": "<string>"
},
"filter": {
"q": "<string>",
"attributes": [
{
"attribute": "<string>",
"comparator": "<string>",
"value": [
"<string>"
]
}
],
"list": "<string>",
"valid": true,
"invalid": true,
"blocked": true,
"unblocked": true,
"optIn": true
},
"optInConfirmation": "<string>",
"optIn": "2023-11-07T05:31:56Z",
"optOut": "2023-11-07T05:31:56Z"
}
],
"attributes": {},
"optIn": "2023-11-07T05:31:56Z",
"blocked": "2023-11-07T05:31:56Z",
"activecampaign": {
"id": 123
},
"hubspot": {
"id": 123
},
"pipedrive": {
"id": 123
},
"valid": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
},
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
}
],
"estimatedPrice": 123
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Account to apply operations to
Body
application/json
List of conversation ids to send messages to
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
SMS, MMS List of media objects to attach to message
Show child attributes
Show child attributes
⌘I