Sobot API Documentation
Welcome to the Sobot API documentation! Our API allows you to seamlessly integrate the power of the Sobot platform into your applications, enabling you to manage WhatsApp interactions effectively. Sobot is a SaaS platform designed to provide a comprehensive WhatsApp team inbox that facilitates seamless communication with customers, resolution of queries, execution of marketing campaigns, and more.
Whether you're building a customer support tool, enhancing your marketing capabilities, or creating innovative communication solutions, the Sobot API empowers you with a range of operations to interact with the WhatsApp team inbox and harness its features.
Getting Started
To get started with the Sobot API, you'll need an Access & Secret Keys that you can obtain by signing up for an account on our platform. Once you have your Access & Secret keys, you can authenticate your requests and start accessing the Sobot API endpoints.
We provide language bindings in several programming languages, including Shell, Python, and JavaScript. In this documentation, you'll find code examples demonstrating API usage in these languages. The code examples are displayed in the dark area to the right, and you can easily switch between programming languages using the tabs in the top right corner of the code examples.
API Endpoints and Operations
The Sobot API supports a variety of operations that allow you to interact with the WhatsApp team inbox seamlessly. Some of the key operations supported by the API include:
Add Customer: You can use this endpoint to add new customers to the WhatsApp team inbox, ensuring that you maintain a comprehensive contact list.
Initiate Campaigns: Launch and manage marketing campaigns directly from your application using the API, enabling you to engage with your audience effectively.
Send Messages: Send various types of messages, including text, videos, images, and templates, to customers through the WhatsApp team inbox, facilitating efficient communication.
Create/Sync Templates: Simplify message creation by utilizing templates. This endpoint allows you to create and synchronize message templates effortlessly.
Explore and Integrate
This documentation serves as your comprehensive guide to integrating the Sobot API into your applications. You'll find detailed explanations, code examples, and best practices to ensure a smooth integration process.
So, whether you're aiming to enhance customer support, execute marketing strategies, or innovate with WhatsApp communication, the Sobot API equips you with the tools you need. Let's explore the possibilities together!
Feel free to refer to the code examples on this page and select the programming language that suits your development environment. If you have any questions or need assistance, don't hesitate to reach out to our support team.
Let's dive into the world of seamless WhatsApp communication with Sobot API!
Authentication
Sobot employs authentication keys to grant access to its API. To acquire a new Sobot API keys, please follow below instructons to obtain keys from our portal.
Sign In to app.sobot.in -> Settings -> Developers tools - > Generate New Keys
(Only Admin can generate API Keys.)
For each API request directed to the server, Sobot requires the API keys to be included in the header. The header should follow this format:
x-api-key: yourapiaccesskey
x-api-secret: yourapisecretkey
These keys play a crucial role in ensuring the security and validity of API interactions. Please ensure that you incorporate your provided access and secret keys correctly in the headers of your API requests.
Customers
Customers are the user to whom your business interacts through WhatsApp. You can add the customers through API or through Sobot Panel. Sobot automatically adds customers if they messaged your business very first time.
Add Customer
curl --location --globoff 'https://api.sobot.in/api/customer' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"mobile": "919561XXXXXX",
"name": "John Doe",
"email": "john@example.com",
"facebook_profile": "https://facebook.com/johndoe",
"linkedin_profile": "https://www.linkedin.com/in/johndoe/",
"twitter_profile": "https://www.twitter.com/johndoe/",
"gender": "Male",
"date_of_birth": "12-12-1991",
"extra_fields": {
"joining_data": "2023-01-12"
},
"labels": ["label1", "label2", "label3"]
}'
import requests
import json
url = "https://api.sobot.in/api/customer"
payload = json.dumps(
{
"mobile": "919561XXXXXX",
"name": "John Doe",
"email": "john@example.com",
"facebook_profile": "https://facebook.com/johndoe",
"linkedin_profile": "https://www.linkedin.com/in/johndoe/",
"twitter_profile": "https://www.twitter.com/johndoe/",
"gender": "Male",
"date_of_birth": "12-12-1991",
"extra_fields": {
"joining_data": "2023-01-12"
},
"labels": ["label1", "label2", "label3"]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/customer');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"mobile": "919561XXXXXX",
"name": "John Doe"
"email": "john@example.com",
"facebook_profile": "https://facebook.com/johndoe",
"linkedin_profile": "https://www.linkedin.com/in/johndoe/",
"twitter_profile": "https://www.twitter.com/johndoe/",
"gender": "Male",
"date_of_birth": "12-12-1991",
"extra_fields": {
"joining_data": "2023-01-12"
},
"labels": ["label1", "label2", "label3"] \n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Customer added successfully",
"code": 201
}
If customer already exist with same mobile number, you will get following response.
{
"message": "Customer already exists",
"code": 400
}
If number is not valid as per the required length or as per the standard rules, you will get following response.
{
"message": "Invalid mobile number",
"code": 400
}
This API allows you to Add Customer to Sobot Platform. Once it is added and that phone number is available on WhatsApp, you are ready to send WhatsApp messages to them.
HTTP Request
POST https://api.sobot.in/api/customer
Body Parameters
Parameter | Required | Description |
---|---|---|
mobile | Yes | A WhatsApp enabled mobile number with country code. Don't prefix '+' or '#'. Maximum Length: 15 Characters (including country code) |
name | Yes | A name of customer. Maximum Length: 100 Characters |
No | Email ID of a customer. This should be in a valid format. | |
gender | No | A gender of a customer. Valid values are : Male or Famale |
date_of_birth | No | Birthdate of a customer in a valid format. Valid Format: DD-MM-YYYY |
facebook_profile | No | A Link of Facebook profile of a customer. |
linkedin_profile | No | A Link of LinkedIn profile of a customer. |
twitter_profile | No | A Link of Twitter profile of a customer. |
extra_fields | No | This is a JSON object which accepts a Key value pair. This allows you to introduce new fields on customer profile as per your need. A Key in JSON should not have a space. If your keys have a space then replace it with underscore (_). e.g. { "joining_data": "2023-01-12" } |
labels | No | List of labels to apply to customer. You can apply Labels to your customers while you are adding them. This is a JSON array of strings . |
Update Customer
curl -X PUT --location --globoff 'https://api.sobot.in/api/customer/<mobile_number>' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"name": "John Doe",
"email": "john@example.com",
"facebook_profile": "https://facebook.com/johndoe",
"linkedin_profile": "https://www.linkedin.com/in/johndoe/",
"twitter_profile": "https://www.twitter.com/johndoe/",
"gender": "Male",
"date_of_birth": "12-12-1991",
"extra_fields": {
"joining_data": "2023-01-12"
},
"labels": ["label1", "label2", "label3"]
}'
import requests
import json
url = "https://api.sobot.in/api/customer"
payload = json.dumps(
{
"mobile": "919561XXXXXX",
"name": "John Doe",
"email": "john@example.com",
"facebook_profile": "https://facebook.com/johndoe",
"linkedin_profile": "https://www.linkedin.com/in/johndoe/",
"twitter_profile": "https://www.twitter.com/johndoe/",
"gender": "Male",
"date_of_birth": "12-12-1991",
"extra_fields": {
"joining_data": "2023-01-12"
},
"labels": ["label1", "label2", "label3"]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/customer');
$request->setMethod(HTTP_Request2::METHOD_PUT);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"mobile": "919561XXXXXX",
"name": "John Doe"
"email": "john@example.com",
"facebook_profile": "https://facebook.com/johndoe",
"linkedin_profile": "https://www.linkedin.com/in/johndoe/",
"twitter_profile": "https://www.twitter.com/johndoe/",
"gender": "Male",
"date_of_birth": "12-12-1991",
"extra_fields": {
"joining_data": "2023-01-12"
},
"labels": ["label1", "label2", "label3"] \n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Customer updated successfully",
"code": 201
}
If number is not valid as per the required length or as per the standard rules, you will get following response.
{
"message": "Invalid mobile number",
"code": 400
}
This API allows you to Update Customer data on Sobot Platform.
HTTP Request
PUT https://api.sobot.in/api/customer/<mobile_number>
Path Parameters
Parameter | Required | Description |
---|---|---|
mobile_number | Yes | A customer mobile number with country code. Don't prefix '+' or '#'. |
Body Parameters
Parameter | Required | Description |
---|---|---|
name | Yes | A name of customer. Maximum Length: 100 Characters |
No | Email ID of a customer. This should be in a valid format. | |
gender | No | A gender of a customer. Valid values are : Male or Famale |
date_of_birth | No | Birthdate of a customer in a valid format. Valid Format: DD-MM-YYYY |
facebook_profile | No | A Link of Facebook profile of a customer. |
linkedin_profile | No | A Link of LinkedIn profile of a customer. |
twitter_profile | No | A Link of Twitter profile of a customer. |
extra_fields | No | This is a JSON object which accepts a Key value pair. This allows you to introduce new fields on customer profile as per your need. A Key in JSON should not have a space. If your keys have a space then replace it with underscore (_). e.g. { "joining_data": "2023-01-12" } |
labels | No | List of labels to apply to customer. This will replace all earlier labels, if any and apply the new ones. This is a JSON array of strings. |
Get All Customers
curl --location --globoff 'https://api.sobot.in/api/customer' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
import requests
import json
url = "https://api.sobot.in/api/customer"
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/customer');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"count": 145,
"size": 20,
"next": "https://api.sobot.in/api/customer?page=2",
"previous": null,
"code": 200,
"data": [
{
"id": 3588183,
"name": "John Doe",
"first_name": "John",
"last_name": "Doe",
"mobile": "919561XXXXXX"
},
{
"id": 3418855,
"name": "Jane Doe",
"first_name": "Jane",
"last_name": "Doe",
"mobile": "919970XXXXXX"
}
]
}
This API allows you to get all customer from your Sobot account. API response is paginated with page size of 20.
HTTP Request
GET https://api.sobot.in/api/customer
Response Parameters
First level Keys
Parameter | Description |
---|---|
Data | Array of json objects of customer's data. Check below table for detail object specification. |
count | Total count of customers in your account |
size | size of a current page |
next | Link to the next page (if any, else null) |
previous | Link to the previous page (if any, else null) |
code | 200 in case of success. Check Errors for other codes. |
Data Object
Parameter | Description |
---|---|
id | Unique identifier for each customer. |
name | A full name of a customer. |
first_name | A first name of a customer (if any). |
last_name | A last name of a customer (if any). |
mobile | Mobile number of a customer with country code but without '+' or '#' sign. |
Free-flow Messages
Text Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"message":"Hello",
"type":"text",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"message": "Hello",
"type": "text",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{"message":"Hello",
"type":"text",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe"}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send text messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
message | Yes | The text of the text message which can contain URLs which begin with http:// or https://(All URLs are set to preview in message by default.) and formatting (See Below for formattting options) . Maximum length: 4096 characters |
- |
type | Yes | Type of message contents. Set to Text in case of Text messages. |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
WhatsApp allows some formatting in messages. To format all or part of a message, use these formatting symbols:
Formatting | Symbol | Example |
---|---|---|
Bold | Asterisk (*) | Your total is $10.50. |
Italics | Underscore (_) | Welcome to WhatsApp! |
Strike-through | Tilde (~) | This is ~better~ best! |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Image Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"type": "image",
"url": "https://example.com/images/20230625_003239.jpg",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "image/jpeg"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps({
"type": "image",
"url": "https://example.com/images/20230625_003239.jpg",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "image/jpeg"
})
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey'
));
$request->setBody('{\n
"type": "image",\n
"url": "https://example.com/images/20230625_003239.jpg",\n
"customer_number": "919970XXXXXX",\n
"customer_name": "John Doe",\n
"mime_type": "image/jpeg"\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send image messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
type | Yes | Type of message contents. Set to image in case of Image messages. |
- |
url | Yes | URL of an image you want to send to customer and this image should be publicly accessible. Please check supported Media Types below. |
- |
mime_type | Yes | Mime-type of image that you added in the URL e.g. image/jpeg, image/png |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
caption | No | The text to send along with the image message. Maximum length: 1024 characters |
- |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
image | image/jpeg, image/png Images must be 8-bit, RGB or RGBA | 5MB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Sticker Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"type": "image",
"url": "https://example.com/stickers/20230625_003239.webp",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "image/webp"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps({
"type": "image",
"url": "https://example.com/stickers/20230625_003239.webp",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "image/webp"
})
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey'
));
$request->setBody('{\n
"type": "image",\n
"url": "https://example.com/stickers/20230625_003239.webp",\n
"customer_number": "919970XXXXXX",\n
"customer_name": "John Doe",\n
"mime_type": "image/webp"\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send sticker messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
type | Yes | Type of message contents. Set to sticker in case of Sticker messages. |
- |
url | Yes | URL of an sticker you want to send to customer and this sticker file should be publicly accessible. Please check supported Media Types below. |
- |
mime_type | Yes | Mime-type of image that you added in the URL e.g. image/webp |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
sticker | image/webp | Static stickers: 100KB Animated stickers: 500KB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Video Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"type": "video",
"url": "https://example.com/videos/20230625_003239.mp4",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "video/mp4"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"type": "video",
"url": "https://example.com/videos/20230625_003239.mp4",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "video/mp4"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey'
));
$request->setBody('{\n "type": "video",\n
"url": "https://example.com/videos/20230625_003239.mp4",\n
"customer_number": "919970XXXXXX",\n
"customer_name": "John Doe",\n
"mime_type": "video/mp4"\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send video messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
type | Yes | Type of message contents. Set to video in case of Video messages. |
- |
url | Yes | URL of an video you want to send to customer and this video file should be publicly accessible. Please check supported Media Types below. |
- |
mime_type | Yes | Mime-type of image that you added in the URL e.g. video/mp4, video/3gp |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
caption | No | The text to send along with the video message. Maximum length: 1024 characters |
- |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
video | video/mp4, video/3gp Notes: Only H.264 video codec and AAC audio codec is supported. We support videos with a single audio stream or no audio stream. |
16MB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Document Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"type": "document",
"url": "https://example.com/documents/20230625_003239.pdf",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "application/pdf",
"filename": "file.pdf"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"type": "document",
"url": "https://example.com/documents/20230625_003239.pdf",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"mime_type": "application/pdf",
"filename": "file.pdf"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type': 'application/json'
));
$request->setBody('{\n "type": "document",\n
"url": "https://example.com/documents/20230625_003239.pdf",\n
"customer_number": "919970XXXXXX",\n
"customer_name": "John Doe",\n
"mime_type": "application/pdf",\n
"filename": "file.pdf"\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send document messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
type | Yes | Type of message contents. Set to document in case of document messages. |
- |
url | Yes | URL of an document you want to send to customer and this document file should be publicly accessible. Please check supported Media Types below. |
- |
mime_type | Yes | Mime-type of image that you added in the URL e.g. application/pdf, application/msword |
- |
filename | Yes | Name of a file that you have mentioned in a url parameter. |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
caption | No | The text to send along with the document message. Maximum length: 1024 characters |
- |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
document | text/plain, application/pdf, application/vnd.ms-powerpoint, application/msword, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | 100MB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Location Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"type": "location",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"longitude": "78.272125",
"latitude": "13.891411",
"location_name": "New York, NYC",
"address": "13, New York Street, NY, US."
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"type": "location",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"longitude": "78.272125",
"latitude": "13.891411",
"location_name": "New York, NYC",
"address": "13, New York Street, NY, US."
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type': 'application/json'
));
$request->setBody('{\n {
"type": "location",\n
"customer_number": "919970XXXXXX",\n
"customer_name": "John Doe",\n
"longitude": "78.272125",\n
"latitude": "13.891411",\n
"location_name": "New York, NYC",\n
"address": "13, New York Street, NY, US."}\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send location messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
type | Yes | Type of message contents. Set to location in case of Location messages. |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
longitude | Yes | Longitude of the location. | - |
latitude | Yes | Latitude of the location. | - |
name | No | Name of the location. | - |
Address | No | Only displayed if name is present. | - |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Button Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "quick_reply",
"buttons": ["one", "two", "three"],
"header": "This is a header",
"caption": "This will go in footer"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "quick_reply",
"buttons": ["one", "two", "three"],
"header": "This is a header",
"caption": "This will go in footer"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"message":"Hello",\n
"customer_number":"919970XXXXXX",\n
"customer_name": "John Doe",\n
"type": "quick_reply",\n
"buttons": ["one", "two", "three"], \n
"header": "This is a header",\n
"caption": "This will go in footer"
\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send messages with Buttons (Quick reply) to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default |
---|---|---|---|
message | Yes | The text of the text message which can contain URLs which begin with http:// or https://(All URLs are set to preview in message by default.) and formatting (See Below for formattting options) . Maximum length: 1024 characters |
- |
type | Yes | Type of message contents. Set to quick_reply in case of Button messages. |
- |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- |
customer_name | Yes | Name of a customer for future reference | - |
buttons | Yes | Array of strings consist of Title of buttons. You can have up to 3 buttons. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters for each botton title. |
- |
header | No | Header content displayed on top of a message. No Emojis. markdown and Links are supported Maximum length: 60 characters. | - |
caption | No | The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters. | - |
WhatsApp allows some formatting in messages. To format all or part of a message, use these formatting symbols:
Formatting | Symbol | Example |
---|---|---|
Bold | Asterisk (*) | Your total is $10.50. |
Italics | Underscore (_) | Welcome to WhatsApp! |
Strike-through | Tilde (~) | This is ~better~ best! |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
List Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "list",
"header": "This is a header",
"caption": "This will go in footer",
"list_obj": {
"button": "Show List",
"sections": [
{
"title": "one",
"rows": [
{
"title": "First title",
"id": "id_1",
"description": "test description"
},
{
"title": "second title",
"id": "id_2",
"description": "test description"
}
]
}
]
}
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "quick_reply",
"header": "This is a header",
"caption": "This will go in footer",
"list_obj": {
"button": "Show List",
"sections": [
{
"title": "one",
"rows": [
{
"title": "First title",
"id": "id_1",
"description": "test description"
},
{
"title": "second title",
"id": "id_2",
"description": "test description"
}
]
}
]
}
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"message":"Hello",\n
"customer_number":"919970XXXXXX",\n
"customer_name": "John Doe",\n
"type": "quick_reply",\n
"header": "This is a header",\n
"caption": "This will go in footer"
"list_obj": {\n
"button": "Show List",\n
"sections": [\n
{\n
"title": "one",\n
"rows": [\n
{\n
"title": "First title",\n
"id": "id_1",\n
"description": "test description"\n
},\n
{\n
"title": "second title",\n
"id": "id_2",\n
"description": "test description"\n
}\n
]\n
}\n
]\n
}\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send List messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
message | Yes | The text of the text message which can contain URLs which begin with http:// or https://(All URLs are set to preview in message by default.) and formatting (See Below for formattting options) . Maximum length: 1024 characters |
- | |||||||||||||
type | Yes | Type of message contents. Set to list in case of List messages. |
- | |||||||||||||
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- | |||||||||||||
customer_name | Yes | Name of a customer for future reference | - | |||||||||||||
list_obj | Yes | A object which consist of following parameters.
|
- | |||||||||||||
header | No | Header content displayed on top of a message. No Emojis. markdown and Links are supported Maximum length: 60 characters. | - | |||||||||||||
caption | No | The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters. | - |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Single Product Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "product",
"caption": "This will go in footer",
"product_list": {"product_retailer_id": "sbt_in_4_1"}
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "product",
"caption": "This will go in footer",
"product_list": {"product_retailer_id": "sbt_in_4_1"}
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"message":"Hello",\n
"customer_number":"919970XXXXXX",\n
"customer_name": "John Doe",\n
"type": "product",\n
"caption": "This will go in footer",\n
"product_list": {"product_retailer_id": "sbt_in_4_1"}\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Single Product messages to customers using the Sobot platform, enabling seamless communication with your customer.
This API needs Meta catalog to be connected to your WhatsApp business account. The catalog id should be updated in Sobot before using this API. This API uses that catalog id as a default for refering all your products with product_retailer_id
.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default | ||||||
---|---|---|---|---|---|---|---|---|---|
message | Yes | The text of the text message which can contain URLs which begin with http:// or https://(All URLs are set to preview in message by default.) and formatting (See Below for formattting options) . Maximum length: 1024 characters |
- | ||||||
type | Yes | Type of message contents. Set to product in case of Single Product messages. |
- | ||||||
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- | ||||||
customer_name | Yes | Name of a customer for future reference | - | ||||||
product_list | Yes | A object which consist of following parameters.
|
- | ||||||
caption | No | The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters. | - |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Multi-product Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "product",
"header": "This is a header",
"caption": "This will go in footer",
"product_list": {
"sections": [
{
"title": "Cakes",
"product_items": [
{
"product_retailer_id": "sbt_in_4_1"
},
{
"product_retailer_id": "sbt_in_4_2"
}
]
}
]
}
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"message":"Hello",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"type": "product",
"header": "This is a header",
"caption": "This will go in footer",
"product_list": {
"sections": [
{
"title": "Cakes",
"product_items": [
{
"product_retailer_id": "sbt_in_4_1"
},
{
"product_retailer_id": "sbt_in_4_2"
}
]
}
]
}
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"message":"Hello",\n
"customer_number":"919970XXXXXX",\n
"customer_name": "John Doe",\n
"type": "product",\n
"header": "This is a header",\n
"caption": "This will go in footer",\n
"product_list": {\n
"sections": [\n
{\n
"title": "Cakes",\n
"product_items": [\n
{\n
"product_retailer_id": "sbt_in_4_1"\n
},\n
{\n
"product_retailer_id": "sbt_in_4_2"\n
}\n
]\n
}\n
]\n
}\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Single Product messages to customers using the Sobot platform, enabling seamless communication with your customer.
This API needs Meta catalog to be connected to your WhatsApp business account. The catalog id should be updated in Sobot before using this API. This API uses that catalog id as a default for refering all your products with product_retailer_id
.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description | Default | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
message | Yes | The text of the text message which can contain URLs which begin with http:// or https://(All URLs are set to preview in message by default.) and formatting (See Below for formattting options) . Maximum length: 1024 characters |
- | ||||||||||
type | Yes | Type of message contents. Set to product in case of Single Product messages. |
- | ||||||||||
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
- | ||||||||||
customer_name | Yes | Name of a customer for future reference | - | ||||||||||
product_list | Yes | A object which consist of following parameters.
|
- | ||||||||||
header | No | Header content displayed on top of a message. No Emojis. markdown and Links are supported Maximum length: 60 characters. | - | ||||||||||
caption | No | The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters. | - |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Templates
WhatsApp message templates are specific message formats that businesses use to send out notifications or customer care messages to people that have opted in to notifications. Messages can include appointment reminders, shipping information, issue resolution or payment updates.
Templates must be approved before they can be sent in template messages. In addition, templates may be disabled automatically based on customer feedback. Once disabled, a template cannot be sent in a template message until its quality rating has improved or it no longer violates our business or commerce policies.
Add Text Template
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT"
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"category": "UTILITY",\n
"entity_name": "hello_world",\n
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",\n
"template_type": "TEXT"\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Text Template to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to TEXT in case of Text templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
header_type | No | Required if want add header. Type of header for template. Set to TEXT in case of Text header. |
header | No | This is text for header, cannot contain Emojis, markdown. Header is required if header_type is TEXT . Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Add Text Template with Variables
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a {{1}} message notification from the {{2}},
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT",
"example_body_param": {
"body_text":
[
["WhatsApp","Cloud API"]
]
}
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a {{1}} message notification from the {{2}}, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT",
"example_body_param": {
"body_text":
[
["WhatsApp","Cloud API"]
]
}
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"category": "UTILITY",\n
"entity_name": "hello_world",\n
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a {{1}} message notification from the {{2}},
hosted by Meta. Thank you for taking the time to test with us.",\n
"template_type": "TEXT",\n
"example_body_param": {\n
"body_text":\n
[\n
["WhatsApp","Cloud API"]\n
]\n
}
}\n'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Text Template to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
Template Variables
Template variables help you add template with placeholders whose value can be set at the time of sending this template as a message. Any template that has one or more variables requires a sample in order to be submitted for review. You can add samples by including the example property in API request.
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to TEXT in case of Text templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
header_type | No | Required if want add header. Type of header for template. Set to TEXT in case of Text header. |
header | No | This is text for header, cannot contain Emojis, markdown. One variable parameter is allowed. Header is required if header_type is TEXT . Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
example_body_param | No | If template body has variables then this parameter is required. This parameter holds json object of array of strings as example values. (Check format in code example) |
example_header_param | No | If template header has variable then this parameter is required. This parameter holds json object of array of a single string as example value. (Check format in code example) |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Add Button Template
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT",
"buttons": ["Yes", "No", "May be"]
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT",
"buttons": ["Yes", "No", "May be"]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"category": "UTILITY",\n
"entity_name": "hello_world",\n
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",\n
"template_type": "TEXT"\n
"buttons: ["Yes", "No", "May be"]\n
\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Text Template with Buttons(Quick replies) to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to TEXT in case of Text templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
buttons | Yes | Array of strings consist of Title of buttons. You can have up to 3 buttons. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters for each botton title. |
header_type | No | Required if want add header. Type of header for template. Set to TEXT in case of Text header. |
header | No | This is text for header, cannot contain Emojis, markdown. Header is required if header_type is TEXT . Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Add Template with CTA
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT",
"sub_type": "CTA",
"phone_numbers": [{"phone_number": "919561XXXXXX", "text": "Call Now"}],
"url" : "https://example.com/register/customer/{{1}}",
"example_webiste": "https://example.com/register/customer/delhi",
"url_name": "Register Now"
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "UTILITY",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "TEXT"
"sub_type": "CTA",
"phone_numbers": [{"phone_number": "919561XXXXXX", "text": "Call Now"}],
"url" : "https://example.com/register/customer/{{1}}",
"example_webiste": "https://example.com/register/customer/delhi",
"url_name": "Register Now"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{\n
"category": "UTILITY",\n
"entity_name": "hello_world",\n
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",\n
"template_type": "TEXT",\n
"sub_type": "CTA",\n
"phone_numbers": [{"phone_number": "919561XXXXXX", "text": "Call Now"}],\n
"url" : "https://example.com/register/customer/{{1}}",\n
"example_webiste": "https://example.com/register/customer/delhi",\n
"url_name": "Register Now"\n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Text Template with Call-to-Action buttons to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
Call-to-Action buttons can be of two types:
- Website link
- Phone number
You can have maximum two CTA buttons as per following combinations:
- Single button with website link
- Single button with Phone number
- Two buttons, one for website link & another for phone number
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to TEXT in case of Text templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
sub_type | Yes | Set its value to CTA if you want to add Call-to-Action buttons in your template. |
phone_numbers | Yes | Required if you want to add Phone number as on of the Call-to-Action. It accepts JSON Array of single json object which has two keys as follows.
|
url | Yes | If sub_type is set to CTA and you want to add Call-to-Action as a website, you will specify website URL here. A website URL can be of of two types:
|
example_website | Yes | If sub_type is set to CTA and you want to add Call-to-Action as a website, with this parameter you will specify example value for a dynamic URL that was added in url . parameter. e.g. https://example.com/register/customer/delhi |
url_name | Yes | If sub_type is set to CTA and you want to add Call-to-Action as a website, with this parameter you will specify name to show for CTA button. Maximum Length : 20 characters |
header_type | No | Required if want add header. Type of header for template. Set to TEXT in case of Text header. |
header | No | This is text for header, cannot contain Emojis, markdown. Header is required if header_type is TEXT . Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Add Image Template
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "MARKETING",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"
"header_type":"IMAGE",
"example":"https://example.com/images/20230625_003239.jpg"
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "MARKETING",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"
"header_type":"IMAGE",
"example":"https://example.com/images/20230625_003239.jpg"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{</span>n
"category": "MARKETING",</span>n
"entity_name": "hello_world",</span>n
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"</span>n
"header_type":"IMAGE",</span>n
"example":"https://example.com/images/20230625_003239.jpg"</span>n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Image Template to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to MEDIA in case of Image templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
header_type | Yes | Required if want add header. Type of header for template. Set to IMAGE in case of Image header. |
example | Yes | Public URL of a header image. This image acts like example for the header, Meta use this as an example image in approval process. You can change this image while you use this template to send the message. example is required if header_type is IMAGE . Please check supported Media Types below. Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
image | image/jpeg, image/png Images must be 8-bit, RGB or RGBA | 5MB |
Add Video Template
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "MARKETING",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"
"header_type":"VIDEO",
"example":"https://example.com/images/20230625_003239.mp4"
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "MARKETING",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"
"header_type":"VIDEO",
"example":"https://example.com/images/20230625_003239.mp4"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{</span>n
"category": "MARKETING",</span>n
"entity_name": "hello_world",</span>n
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"</span>n
"header_type":"VIDEO",</span>n
"example":"https://example.com/images/20230625_003239.mp4"</span>n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Video Template to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to MEDIA in case of Image templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
header_type | Yes | Required if want add header. Type of header for template. Set to VIDEO in case of Video header. |
example | Yes | Public URL of a header video. This video acts like example for the header, Meta use this as an example video in approval process. You can change this video while you use this template to send the message. example is required if header_type is VIDEO . Please check supported Media Types below. Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
video | video/mp4, video/3gp Notes: Only H.264 video codec and AAC audio codec is supported. We support videos with a single audio stream or no audio stream. |
16MB |
Add document Template
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"category": "MARKETING",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates
your ability to send a WhatsApp message notification from the Cloud API,
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"
"header_type":"DOCUMENT",
"example":"https://example.com/images/20230625_003239.pdf"
}'
import requests
import json
url = "https://api.sobot.in/api/template/"
payload = json.dumps(
{
"category": "MARKETING",
"entity_name": "hello_world",
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"
"header_type":"DOCUMENT",
"example":"https://example.com/images/20230625_003239.pdf"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{</span>n
"category": "MARKETING",</span>n
"entity_name": "hello_world",</span>n
"body": "Welcome and congratulations!! This message demonstrates \
your ability to send a WhatsApp message notification from the Cloud API, \
hosted by Meta. Thank you for taking the time to test with us.",
"template_type": "MEDIA"</span>n
"header_type":"DOCUMENT",</span>n
"example":"https://example.com/images/20230625_003239.pdf"</span>n}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"message": "Template created successfully",
"code": 201
}
This API allows you to Add Document Template to your WABA account using Sobot platform. Once it is added, it will go through approval process from Meta.
HTTP Request
POST https://api.sobot.in/api/template/
Body Parameters
Parameter | Required | Description |
---|---|---|
category | Yes | Defines the type of template. Possible values are
|
entity_name | Yes | This is to refer template in future use. Duplicate entity_name is not allowed. No spaces allowed in entity_name . (if space is added, it will be replaced with _.) Maximum Length: 128 Characters. |
template_type | Yes | Type of template contents. Set to MEDIA in case of Image templates. |
body | Yes | Main body of Template. You should have text in same language as mentioned in lang_code parameter. Emojis, markdown, and links are supported. Maximum length: 1024 Characters. |
lang_code | Yes | Specify the language code for body content. (Incorrect language specification may result in temlplate rejection.) For supported languages, check table below. Default is en_US |
header_type | Yes | Required if want add header. Type of header for template. Set to DOCUMENT in case of Document header. |
example | Yes | Public URL of a header document. This document acts like example for the header, Meta use this as an example video in approval process. You can change this document while you use this template to send the message. example is required if header_type is DOCUMENT . Please check supported Media Types below. Maximum Length : 60 characters |
footer | No | This is text for footer, can contain Emojis but not markdown. Maximum Length : 60 characters |
Supported Languages
Lang code | Language |
---|---|
en | English |
en_US | English (US) |
en_GB | English (UK) |
hi | Hindi |
mr | Marathi |
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
document | text/plain, application/pdf, application/vnd.ms-powerpoint, application/msword, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | 100MB |
Get All Templates
curl --location --globoff 'https://api.sobot.in/api/template/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
import requests
import json
url = "https://api.sobot.in/api/template/"
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"count": 80,
"size": 20,
"next": "http://api.sobot.in/api/template/?page=2",
"previous": null,
"code": 200,
"data": [
{
"id": 584,
"phone_numbers": null,
"template": "Dear customer,\n\nYou have not filed one or more GSTR 3B returns. Kindly file your returns immediately to avoid late fee and Interest. Ignore if filed. GSTN",
"entity_name": "march_ending",
"category": "UTILITY",
"template_id": "759559305816228",
"header": null,
"header_type": null,
"template_type": "TEXT",
"sub_type": null,
"buttons": null,
"footer": null,
"url": null,
"example": null,
"example_website": null,
"url_name": null,
"created_at": "2023-03-25T13:26:20.034623+05:30",
"updated_at": null,
"status": 0, //
"rejected_reason": null,
"added_by": 156,
"lang_code": "en"
}
]
}
This API allows you to Get all Templates from your WABA account using Sobot platform. API response is paginated with page size of 20.
HTTP Request
GET https://api.sobot.in/api/template/
Response Parameters
First level Keys
Parameter | Description |
---|---|
Data | Array of json objects of template data. Check below table for detail object specification. |
count | Total count of templates in your account |
size | size of a current page |
next | Link to the next page (if any, else null) |
previous | Link to the previous page (if any, else null) |
code | 200 in case of success. Check Errors for other codes. |
Data Object
Parameter | Description |
---|---|
id | System generated ID for each template |
template | Body of the template. Usually a text including Emojis, variables, markdown for formatting. |
entity_name | Name of the template |
category | Category of template It can be:
|
template_type | Template type value can be:
|
lang_code | Language code of template content. Actaully denotes the Language of the template. |
template_id | A Meta generated unique ID for template. You can refer this for future operations. |
header | Text of header in case of header_type = Text . |
header_type | Header type value can be:
|
footer | Text of footer. It can have emojis in it. |
example | a public URL of header data excpet for TEXT . |
sub_type | This can be either null or CTA . If it is set to CTA , it specifies that this template has CTAs in its button. CTAs can be either phone numbers and/or website. For phone number check phone_numbers and for website check url , url_name and example_website |
buttons | This helps to identify buttons (Quick reply) of templates. It will return array of strings. e.g. ["Yes", "NO", "May be"] |
phone_numbers | This return json object with following keys:
|
url | If sub_type is set to CTA, and added CTA is a website, this parameter will give you static part of URL. |
example_website | If sub_type is set to CTA, and added CTA is a website, this parameter will give you example value of variable that was added in url . |
url_name | If sub_type is set to CTA, and added CTA is a website, this parameter will give you name to be shown for CTA button. |
created_at | Date of template creation. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
updated_at | Date of template last updated. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
status | Status of the template. It denotes the status in numbers. Please find below the number & its meaning.
|
rejected_reason | Reason of rejection, if the template status = rejected . Else, this is always null |
added_by | The unique ID of a user who has added this template on Sobot Platform. |
Get Pending Templates
curl --location --globoff 'https://api.sobot.in/api/template/?status=0' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
import requests
import json
url = "https://api.sobot.in/api/template/?status=0"
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/?status=0');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"count": 80,
"size": 20,
"next": "http://api.sobot.in/api/template/?status=0&page=2",
"previous": null,
"code": 200,
"data": [
{
"id": 584,
"phone_numbers": null,
"template": "Dear customer,\n\nYou have not filed one or more GSTR 3B returns. Kindly file your returns immediately to avoid late fee and Interest. Ignore if filed. GSTN",
"entity_name": "march_ending",
"category": "UTILITY",
"template_id": "759559305816228",
"header": null,
"header_type": null,
"template_type": "TEXT",
"sub_type": null,
"buttons": null,
"footer": null,
"url": null,
"example": null,
"example_website": null,
"url_name": null,
"created_at": "2023-03-25T13:26:20.034623+05:30",
"updated_at": null,
"status": 0, //
"rejected_reason": null,
"added_by": 156,
"lang_code": "en"
}
]
}
This API allows you to Get all approval pending Templates from your WABA account using Sobot platform. API response is paginated with page size of 20.
HTTP Request
GET https://api.sobot.in/api/template/?status=0
Response Parameters
First level Keys
Parameter | Description |
---|---|
Data | Array of json objects of template data. Check below table for detail object specification. |
count | Total count of templates in your account |
size | size of a current page |
next | Link to the next page (if any, else null) |
previous | Link to the previous page (if any, else null) |
code | 200 in case of success. Check Errors for other codes. |
Data Object
Parameter | Description |
---|---|
id | System generated ID for each template |
template | Body of the template. Usually a text including Emojis, variables, markdown for formatting. |
entity_name | Name of the template |
category | Category of template It can be:
|
template_type | Template type value can be:
|
lang_code | Language code of template content. Actaully denotes the Language of the template. |
template_id | A Meta generated unique ID for template. You can refer this for future operations. |
header | Text of header in case of header_type = Text . |
header_type | Header type value can be:
|
footer | Text of footer. It can have emojis in it. |
example | a public URL of header data excpet for TEXT . |
sub_type | This can be either null or CTA . If it is set to CTA , it specifies that this template has CTAs in its button. CTAs can be either phone numbers and/or website. For phone number check phone_numbers and for website check url , url_name and example_website |
buttons | This helps to identify buttons (Quick reply) of templates. It will return array of strings. e.g. ["Yes", "NO", "May be"] |
phone_numbers | This return json object with following keys:
|
url | If sub_type is set to CTA, and added CTA is a website, this parameter will give you static part of URL. |
example_website | If sub_type is set to CTA, and added CTA is a website, this parameter will give you example value of variable that was added in url . |
url_name | If sub_type is set to CTA, and added CTA is a website, this parameter will give you name to be shown for CTA button. |
created_at | Date of template creation. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
updated_at | Date of template last updated. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
status | Status of the template. In thi case its always 0 for pending templates. |
rejected_reason | Reason of rejection, if the template status = 2 i.e. Rejected. Else, this is always null |
added_by | The unique ID of a user who has added this template on Sobot Platform. |
Get Approved Templates
curl --location --globoff 'https://api.sobot.in/api/template/?status=1' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
import requests
import json
url = "https://api.sobot.in/api/template/?status=1"
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/?status=1');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"count": 80,
"size": 20,
"next": "http://api.sobot.in/api/template/?status=1&page=2",
"previous": null,
"code": 200,
"data": [
{
"id": 584,
"phone_numbers": null,
"template": "Dear customer,\n\nYou have not filed one or more GSTR 3B returns. Kindly file your returns immediately to avoid late fee and Interest. Ignore if filed. GSTN",
"entity_name": "march_ending",
"category": "UTILITY",
"template_id": "759559305816228",
"header": null,
"header_type": null,
"template_type": "TEXT",
"sub_type": null,
"buttons": null,
"footer": null,
"url": null,
"example": null,
"example_website": null,
"url_name": null,
"created_at": "2023-03-25T13:26:20.034623+05:30",
"updated_at": null,
"status": 0, //
"rejected_reason": null,
"added_by": 156,
"lang_code": "en"
}
]
}
This API allows you to Get all approval pending Templates from your WABA account using Sobot platform. API response is paginated with page size of 20.
HTTP Request
GET https://api.sobot.in/api/template/?status=1
Response Parameters
First level Keys
Parameter | Description |
---|---|
Data | Array of json objects of template data. Check below table for detail object specification. |
count | Total count of templates in your account |
size | size of a current page |
next | Link to the next page (if any, else null) |
previous | Link to the previous page (if any, else null) |
code | 200 in case of success. Check Errors for other codes. |
Data Object
Parameter | Description |
---|---|
id | System generated ID for each template |
template | Body of the template. Usually a text including Emojis, variables, markdown for formatting. |
entity_name | Name of the template |
category | Category of template It can be:
|
template_type | Template type value can be:
|
lang_code | Language code of template content. Actaully denotes the Language of the template. |
template_id | A Meta generated unique ID for template. You can refer this for future operations. |
header | Text of header in case of header_type = Text . |
header_type | Header type value can be:
|
footer | Text of footer. It can have emojis in it. |
example | a public URL of header data excpet for TEXT . |
sub_type | This can be either null or CTA . If it is set to CTA , it specifies that this template has CTAs in its button. CTAs can be either phone numbers and/or website. For phone number check phone_numbers and for website check url , url_name and example_website |
buttons | This helps to identify buttons (Quick reply) of templates. It will return array of strings. e.g. ["Yes", "NO", "May be"] |
phone_numbers | This return json object with following keys:
|
url | If sub_type is set to CTA, and added CTA is a website, this parameter will give you static part of URL. |
example_website | If sub_type is set to CTA, and added CTA is a website, this parameter will give you example value of variable that was added in url . |
url_name | If sub_type is set to CTA, and added CTA is a website, this parameter will give you name to be shown for CTA button. |
created_at | Date of template creation. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
updated_at | Date of template last updated. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
status | Status of the template. In thi case its always 1 for approved templates. |
rejected_reason | Reason of rejection, if the template status = 2 i.e. Rejected. Else, this is always null |
added_by | The unique ID of a user who has added this template on Sobot Platform. |
Get Rejected Templates
curl --location --globoff 'https://api.sobot.in/api/template/?status=2' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
import requests
import json
url = "https://api.sobot.in/api/template/?status=2"
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/api/template/?status=2');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"count": 80,
"size": 20,
"next": "http://api.sobot.in/api/template/?status=2&page=2",
"previous": null,
"code": 200,
"data": [
{
"id": 584,
"phone_numbers": null,
"template": "Dear customer,\n\nYou have not filed one or more GSTR 3B returns. Kindly file your returns immediately to avoid late fee and Interest. Ignore if filed. GSTN",
"entity_name": "march_ending",
"category": "UTILITY",
"template_id": "759559305816228",
"header": null,
"header_type": null,
"template_type": "TEXT",
"sub_type": null,
"buttons": null,
"footer": null,
"url": null,
"example": null,
"example_website": null,
"url_name": null,
"created_at": "2023-03-25T13:26:20.034623+05:30",
"updated_at": null,
"status": 0, //
"rejected_reason": null,
"added_by": 156,
"lang_code": "en"
}
]
}
This API allows you to Get all approval pending Templates from your WABA account using Sobot platform. API response is paginated with page size of 20.
HTTP Request
GET https://api.sobot.in/api/template/?status=2
Response Parameters
First level Keys
Parameter | Description |
---|---|
Data | Array of json objects of template data. Check below table for detail object specification. |
count | Total count of templates in your account |
size | size of a current page |
next | Link to the next page (if any, else null) |
previous | Link to the previous page (if any, else null) |
code | 200 in case of success. Check Errors for other codes. |
Data Object
Parameter | Description |
---|---|
id | System generated ID for each template |
template | Body of the template. Usually a text including Emojis, variables, markdown for formatting. |
entity_name | Name of the template |
category | Category of template It can be:
|
template_type | Template type value can be:
|
lang_code | Language code of template content. Actaully denotes the Language of the template. |
template_id | A Meta generated unique ID for template. You can refer this for future operations. |
header | Text of header in case of header_type = Text . |
header_type | Header type value can be:
|
footer | Text of footer. It can have emojis in it. |
example | a public URL of header data excpet for TEXT . |
sub_type | This can be either null or CTA . If it is set to CTA , it specifies that this template has CTAs in its button. CTAs can be either phone numbers and/or website. For phone number check phone_numbers and for website check url , url_name and example_website |
buttons | This helps to identify buttons (Quick reply) of templates. It will return array of strings. e.g. ["Yes", "NO", "May be"] |
phone_numbers | This return json object with following keys:
|
url | If sub_type is set to CTA, and added CTA is a website, this parameter will give you static part of URL. |
example_website | If sub_type is set to CTA, and added CTA is a website, this parameter will give you example value of variable that was added in url . |
url_name | If sub_type is set to CTA, and added CTA is a website, this parameter will give you name to be shown for CTA button. |
created_at | Date of template creation. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
updated_at | Date of template last updated. Its a timestamp. e.g. 2023-03-25T13:26:20.034623+05:30 |
status | Status of the template. In thi case its always 2 for rejected templates. |
rejected_reason | Reason of rejection, if the template status = 2 i.e. Rejected. Else, this is always null |
added_by | The unique ID of a user who has added this template on Sobot Platform. |
Template Messages
Templates are used in template messages to open marketing, utility, and authentication conversations with customers. Unlike free-form messages, template messages are the only type of message that can be sent to customers who have yet to message you, or who have not sent you a message in the last 24 hours.
Send Text Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe"
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"template_name": "hello_world",
"template_lang": "en",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe"
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe"
}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Text template messages to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description |
---|---|---|
template_name | Yes | Specify the name of the template. You can get the name of template from template GET API. |
template_lang | Yes | Specify the lang_code of the template that you want to send. e.g. en, en_US, en_GB |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
customer_name | Yes | Name of a customer for future reference |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Send Text Message with Variables
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "body",
"parameters":[
{
"type": "text",
"text": "8654334"
},
{
"type": "text",
"text": "Approved"
}
]
}
]
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"template_name": "hello_world",
"template_lang": "en",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "body",
"parameters":[
{
"type": "text",
"text": "8654334"
},
{
"type": "text",
"text": "Approved"
}
]
}
]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"parameters":[
{
"type": "text",
"text": "8654334"
},
{
"type": "text",
"text": "Approved"
}
]
}
]
}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Text template messages along with the variables if Template body has variables in it to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description |
---|---|---|
template_name | Yes | Specify the name of the template. You can get the name of template from template GET API. |
template_lang | Yes | Specify the lang_code of the template that you want to send. e.g. en, en_US, en_GB |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
customer_name | Yes | Name of a customer for future reference |
params | Yes | In case of template body has variables, this JSON array is required. This array consist of JSON array as follows "params":[{ "type": "body", "parameters": [{ "type": "text", "text": "8654334" }, { "type": "text", "text": "Approved" }] } ] Make sure that the list of parameters follows the order as per the variables in your template message. If the parameters count does not matched to variable count in template, sending template will be failed. |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Send Text Message with CTA
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "button",
"sub_type": "url",
"index" : 0
"parameters":[
{
"type": "text",
"text": "8654334"
}
]
}
]
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"template_name": "hello_world",
"template_lang": "en",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "button",
"sub_type": "url",
"index" : 0
"parameters":[
{
"type": "text",
"text": "8654334"
}
]
}
]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "button",
"sub_type": "url",
"index" : 0
"parameters":[
{
"type": "text",
"text": "8654334"
}
]
}
]
}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Text template messages along with Call-to-Action buttons to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description |
---|---|---|
template_name | Yes | Specify the name of the template. You can get the name of template from template GET API. |
template_lang | Yes | Specify the lang_code of the template that you want to send. e.g. en, en_US, en_GB |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
customer_name | Yes | Name of a customer for future reference |
params | Yes | This is a JSON array accepts the single JSON object to specify parameters for Call-to-Action's website link which has variables parameters in it. Following keys are support in JSON object:
|
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Send Image Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "image",
"image":{
"link": "https://example.com/images/20230625_003239.jpg"
}
}
]
}
]
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"template_name": "hello_world",
"template_lang": "en",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "image",
"image": {
"link": "https://example.com/images/20230625_003239.jpg"
}
}
]
}
]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "image",
"image": {
"link": "https://example.com/images/20230625_003239.jpg"
}
}
]
}
]
}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Template messages with Image to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description |
---|---|---|
template_name | Yes | Specify the name of the template. You can get the name of template from template GET API. |
template_lang | Yes | Specify the lang_code of the template that you want to send. e.g. en, en_US, en_GB |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
customer_name | Yes | Name of a customer for future reference |
params | Yes | This is a JSON array accepts the single JSON object to specify image as a header for Image template. JSON object has two keys:
|
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
image | image/jpeg, image/png Images must be 8-bit, RGB or RGBA | 5MB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Send Video Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "video",
"video": {
"link": "https://example.com/videos/20230625_003239.mp4"
}
}
]
}
]
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"template_name": "hello_world",
"template_lang": "en",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "video",
"video": {
"link": "https://example.com/videos/20230625_003239.mp4"
}
}
]
}
]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "video",
"video": {
"link": "https://example.com/videos/20230625_003239.mp4"
}
}
]
}
]
}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Template messages with Video to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description |
---|---|---|
template_name | Yes | Specify the name of the template. You can get the name of template from template GET API. |
template_lang | Yes | Specify the lang_code of the template that you want to send. e.g. en, en_US, en_GB |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
customer_name | Yes | Name of a customer for future reference |
params | Yes | This is a JSON array accepts the single JSON object to specify video as a header for video template. JSON object has two keys:
|
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
video | video/mp4, video/3gp Notes: Only H.264 video codec and AAC audio codec is supported. We support videos with a single audio stream or no audio stream. |
16MB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Send Document Message
curl --location --globoff 'https://api.sobot.in/message/' </span>
--header 'x-api-key: yourapiaccesskey' </span>
--header 'x-api-secret: yourapisecretkey' </span>
--header 'content-type': 'application/json' </span>
--data '{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "document",
"document": {
"link": "https://example.com/documents/20230625_003239.pdf",
"filename" : "20230625_003239.pdf"
}
}
]
}
]
}'
import requests
import json
url = "https://api.sobot.in/message/"
payload = json.dumps(
{
"template_name": "hello_world",
"template_lang": "en",
"customer_number": "919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "document",
"document": {
"link": "https://example.com/documents/20230625_003239.pdf",
"filename" : "20230625_003239.pdf"
}
}
]
}
]
}
)
headers = {
'x-api-key': 'yourapiaccesskey',
'x-api-secret': 'yourapisecretkey',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.sobot.in/message/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'yourapiaccesskey',
'x-api-secret' => 'yourapisecretkey',
'content-type' => 'application/json'
));
$request->setBody('{
"template_name": "hello_world",
"template_lang": "en",
"customer_number":"919970XXXXXX",
"customer_name": "John Doe",
"params":[
{
"type": "header",
"parameters":[
{
"type": "document",
"document": {
"link": "https://example.com/documents/20230625_003239.pdf",
"filename" : "20230625_003239.pdf"
}
}
]
}
]
}'
);
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
The above API call returns JSON response like this:
{
"data": {
"id": "wamid.HBgMOTE5OTcwNTg1NTU2FQIAERgSQjhGRDQ2REFBQjAxMjJBM0Q1AA==",
"status": "submitted"
},
"message": "Message sent successfully.",
"code": 200
}
This API allows you to send Template messages with Document to customers using the Sobot platform, enabling seamless communication with your customer.
HTTP Request
POST https://api.sobot.in/message/
Body Parameters
Parameter | Required | Description |
---|---|---|
template_name | Yes | Specify the name of the template. You can get the name of template from template GET API. |
template_lang | Yes | Specify the lang_code of the template that you want to send. e.g. en, en_US, en_GB |
customer_number | Yes | WhatsApp phone number of the customer you want to send a message to. No Plus signs (+), hyphens (-), parenthesis ((,)), and spaces are supported in customer phone number. We highly recommend that you include country calling code when sending a message to a customer. If the country calling code is omitted, your business phone number's country calling code is prepended to the customer's phone number. This can result in undelivered or misdelivered messages. |
customer_name | Yes | Name of a customer for future reference |
params | Yes | This is a JSON array accepts the single JSON object to specify document as a header for document template. JSON object has two keys:
|
Supported Media Types
Media | Supported Types | Size Limit |
---|---|---|
document | text/plain, application/pdf, application/vnd.ms-powerpoint, application/msword, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | 100MB |
Response
In response of successfully sent messages, you will get id
& status
under data
key. Messages are identified by a unique ID (wamid
). You can track message status in the Webhooks through its wamid
(Check Webhook Documentation for recieving Status events of sent messages on your webhook). This wamid
can have a maximum length of up to 128 characters.
Webhook
Webhooks are triggered when a customer performs an action or the status for a message a business sends a customer changes. You get a webhooks notification:
When a customer performs an action: This alert lets you know when you have received a message. These can also be called "inbound notifications"
- Sends a text message to the business
- Sends an image, video, document, or sticker to the business
- Sends contact information to the business
- Sends location information to the business
- Clicks a reply button set up by the business
When the status for a message received by a business changes: This alert lets you know when the status of a message has changed —for example, the message has been read or delivered. These can also be called "outbound notifications"
- delivered
- sent
- read
Adding a Webhook
Before you can start receiving notifications you will need to create an endpoint on your server to receive notifications.
Your endpoint must be able to process HTTPS requests: Event Notifications. Since requests use HTTPs, your server must have a valid TLS or SSL certificate correctly configured and installed.
Webhooks payloads can be up to 3MB.
Webhook Delivery Failure
Text Message Payload
[
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "918788XXXXXX"
},
"contacts": [
{
"profile": {
"name": "John Deo"
},
"wa_id": "919960XXXXXX"
}
],
"messages": [
{
"from": "919960XXXXXX",
"id": "wamid.HBgMOTE4NDQ2NjAwMjYwFQIAEhggNEIxNkNCRDQzQzUzMDBBQzNFQjQ5RTY3MjFFQkUzRUEA",
"timestamp": "1692945450",
"text": {
"body": "Hi"
},
"type": "text"
}
]
},
"field": "messages"
}
]
Image Message Payload
[
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "918788XXXXXX"
},
"contacts": [
{
"profile": {
"name": "John Deo"
},
"wa_id": "919561XXXXXX"
}
],
"messages": [
{
"from": "919561XXXXXX",
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAEhggNDdERTdDN0RDNDNEOThFMDhGNTZDM0U4RjBCN0QzQ0UA",
"timestamp": "1693910575",
"type": "image",
"image": {
"mime_type": "image/jpeg",
"sha256": "KPWm/epBiakGlJovxzct+oQkwy3u9v3BIeBX3w3aJLA=",
"id": "259395830348745",
"url": "https://sobot-assets.s3.ap-south-1.amazonaws.com/XXXXXXXXXXX/YYYYYYYYYYYY/images/259395830348745"
}
}
]
},
"field": "messages"
}
]
Video Message Payload
[
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "918788XXXXXX"
},
"contacts": [
{
"profile": {
"name": "John Deo"
},
"wa_id": "919561XXXXXX"
}
],
"messages": [
{
"from": "919561XXXXXX",
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAEhggNDdERTdDN0RDNDNEOThFMDhGNTZDM0U4RjBCN0QzQ0UA",
"timestamp": "1693910575",
"type": "video",
"image": {
"mime_type": "video/mp4",
"sha256": "KPWm/epBiakGlJovxzct+oQkwy3u9v3BIeBX3w3aJLA=",
"id": "259395830348745",
"url": "https://sobot-assets.s3.ap-south-1.amazonaws.com/XXXXXXXXXXX/YYYYYYYYYYYY/videos/259395830348745"
}
}
]
},
"field": "messages"
}
]
Message Status Updates
The Sobot Platform sends notifications to inform you of the status of the messages between you and your users. When a message is sent successfully, you receive a notification when the message is sent, delivered, and read. The order of these notifications in your app may not reflect the actual timing of the message status. View the timestamp to determine the timing, if necessary.
Message Sent Status Payload
{
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAERgSRTUzMjRGMDc2OTIzNjBDRkZGAA==",
"status": "sent",
"timestamp": "1692947519"
}
The following notification is received when a business sends a message as part of a user-initiated conversation:
{
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAERgSRTUzMjRGMDc2OTIzNjBDRkZGAA==",
"status": "sent",
"timestamp": "1692947519"
}
Message Delivered Status Payload
{
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAERgSRTUzMjRGMDc2OTIzNjBDRkZGAA==",
"status": "delivered",
"timestamp": "1692947519"
}
The following notification is received when a business’ message is delivered and that message is part of a user-initiated conversation:
{
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAERgSRTUzMjRGMDc2OTIzNjBDRkZGAA==",
"status": "delivered",
"timestamp": "1692947519"
}
Message Read Status Payload
{
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAERgSRTUzMjRGMDc2OTIzNjBDRkZGAA==",
"status": "read",
"timestamp": "1692947519"
}
The following notification is received when a business’ message is read and that message is part of a user-initiated conversation:
{
"id": "wamid.HBgMOTE5NTYxODc4MDgwFQIAERgSRTUzMjRGMDc2OTIzNjBDRkZGAA==",
"status": "read",
"timestamp": "1692947519"
}