WhatsApp API
# WhatsApp API
# API declaration
The "token" param must be contained in the header of the https request when calling the API.
Token is the only global API call credential for the Sobot API open platform. It is used when developers call the business APIs and thus should be properly kept. At least 32 chars should be reserved to store token. The validity period of token is currently 24 hours. It needs to be refreshed regularly or reacquired according to the token failure prompt returned by the API. When requesting the token API, regardless of the existence of token, a new token will be returned and its expiry time will be reset (currently 24 hours).
Token usage description: 1. Developers need to obtain and manage the token uniformly. When calling the Sobot open APIs of various businesses, they should use the same token, instead of refreshing and obtaining new tokens for each business. Otherwise, it will easily lead to token invalidation and affect the normal API call. 2. The current validity period of the token is transmitted by the returned expire_in, which is currently a value within 86,400 seconds. Developers need to refresh the new token in advance based on this valid time. 3. Developers should reacquire the token according to the token invalidation prompt returned by the API.
# API call
# ● Acquire token
API description:
Get the open API token, which is only applicable to all APIs of Sobot Open Platform v5.0. Contact the Sobot after-sales service personnel to get appid and app_key in the API.
Request method:
GET
Request URL:
https://sg.sobot.io/api/get_token
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| appid | String | Yes | API credential id, the unique API call credential id for the 3rd-party users |
| create_time | String | Yes | 10-digit timestamp |
| sign | String | Yes | Signature md5(appid+create_time+app_key) |
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | token code |
| expires_in | String | Yes | Credential valid time (unit: s) |
Timestamp conversion tool:
https://www.unixtimestamp.com/
sign signature generation example:
E.g., appid = "1"; create_time="1569397773"; app_key="2"
sign = Md5("115693977732") is 258eec3118705112b2c53dc8043d4d34.
Request example:
curl https://sg.sobot.io/api/get_token?appid=1&create_time=1569397773&sign=258eec3118705112b2c53dc8043d4d34
Return example:
{
"item": {
"token": "4ac37cb2e9c740dba4b75a34d5358802",
"expires_in": "86400"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
# ● Acquire WhatsApp phone number id
Log in to the Sobot agent system backend, open【Livechat Agent -> Docking Channel Settings -> WhatsApp】and acquire corresponding phone number id of WhatsApp number
# Send message
# ● Send template message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Asynchronous request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/v3/forword
Note: This address request will immediately return a message ID generated by Sobot, making it suitable for use in high-concurrency scenarios.
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | template (fixed value) |
| content | Object | Yes | Message content |
| subjectid | String | No | Marketing theme ID |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| template | Object | Yes | Template content |
template param:
| Param | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Template name |
| language | Object | Yes | Template language |
| components | List | Yes | Template creation variable |
language param:
| Param | Type | Required | Description |
|---|---|---|---|
| code | String | Yes | Template language code |
components param:
Note:
If no variable is created in the WhatsApp backend, components is a null array
If there is a variable, the variable content cannot be null or null string
# 1. Header example
1.1 Header variable is text
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"type": "header",
"parameters": [{
"text": "CONTENT",
"type": "text"
}]
}],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE_NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1.2 Header variable is media
image | video | document (the filename parameter can be passed, peer level as link)
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"type": "header",
"parameters": [{
"image": {
"link": "https://img.sobot.com/console/common/face/robot.png"
},
"type": "image"
}]
}],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE_NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1.3 Header variable is position
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"type": "header",
"parameters": [{
"location": {
"address": "your address",
"latitude": "-12.283171",
"name": "your location name",
"longitude": "130.501951"
},
"type": "LOCATION"
}]
}],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 2. Body variable example
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"type": "body",
"parameters": [{
"text": "CONTENT1",
"type": "text"
}, {
"text": "CONTENT2",
"type": "text"
}]
}],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 3. Button variable example
If the current button variable is the first in the template, index=0, the second, index=1
If the current button variable contains Chinese, it needs to encode the Chinese
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"sub_type": "URL",
"index": 0,
"type": "button",
"parameters": [
{
"payload": "BUTTON CONTENT",
"type": "payload"
}
]
}],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE_NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 4. Complete request example (non OTP)
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"type": "header",
"parameters": [
{
"document": {
"filename": "xxx.txt",
"link": "https://example/xxx.txt"
},
"type": "document"
}
]
},
{
"type": "body",
"parameters": [
{
"text": "CONTENT",
"type": "text"
}
]
},
{
"sub_type": "URL",
"index": 0,
"type": "button",
"parameters": [
{
"payload": "BUTTON CONTENT",
"type": "payload"
}
]
}],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE_NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 5. OTP template message
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"template": {
"components": [{
"type": "body",
"parameters": [{
"type": "text",
"text": "<ONE-TIME PASSWORD>"
}]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [{
"type": "text",
"text": "<ONE-TIME PASSWORD>"
}]
}
],
"language": {
"code": "TEMPLATE_LANGUAGE_CODE"
},
"name": "TEMPLATE NAME"
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 6. Template message with Flow
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '
{
"content": {
"messaging_product": "whatsapp",
"recipient_type": "individual",
"template": {
"language": {
"code": "LANGUAGE_AND_LOCALE_CODE"
},
"name": "TEMPLATE_NAME",
"components": [
{
"type": "button",
"sub_type": "flow",
"index": "0",
"parameters": [
{
"type": "action",
"action": {
"flow_token": "FLOW_TOKEN", //optional, default is "unused"
"flow_action_data": {
...
} // optional, json object with the data payload for the first screen
}
}
]
}
]
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}
'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 7. Send a message using the media Id
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '
{
"content": {
"template": {
"components": [{
"type": "header",
"parameters": [{
"image": {
"id": "1234567890"
},
"type": "image"
}]
}],
"language": {
"code": "en_US"
},
"name": "template_name"
}
},
"from": "1234567890",
"to": "8618888888888",
"type": "template",
"subjectid": "MARKETING SUBJECT ID"
}
'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# ● Send free format message
# 1. Send text message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | text (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Content |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"text": "this is text"
},
"context": {
"messageid": "MESSAGE_ID"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "text"
} '
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 2. Send image message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | image (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| media_url | String | Yes | Resource link |
| caption | String | No | Image description |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"media_url": "https://img.sobot.com/console/common/face/robot.png",
"caption": "this is image"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "image"
} '
2
3
4
5
6
7
8
9
10
11
12
13
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 3. Send file message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | document (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| media_url | String | Yes | Resource link |
| file_name | String | No | File name |
| caption | String | No | File description |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"media_url": "https://img.sobot.com/console/common/face/robot.png",
"file_name": "example.txt",
"caption": "this is file"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "document"
} '
2
3
4
5
6
7
8
9
10
11
12
13
14
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 4. Send video message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | video (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| media_url | String | Yes | Resource link |
| caption | String | No | Video description |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"media_url": "https://img.sobot.com/console/common/face/robot.png",
"caption": "this is video"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "video"
} '
2
3
4
5
6
7
8
9
10
11
12
13
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 5. Send audio message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | audio (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| media_url | String | Yes | Resource link |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"media_url": "https://img.sobot.com/console/common/face/robot.png"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "audio"
} '
2
3
4
5
6
7
8
9
10
11
12
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 6. Send sticker message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | sticker (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| media_url | String | Yes | Resource link |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"media_url": "https://img.sobot.com/console/common/face/robot.png"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "sticker"
} '
2
3
4
5
6
7
8
9
10
11
12
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 7. Send position message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | location (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| latitude | String | Yes | Latitude |
| longitude | String | Yes | Longitude |
| name | String | No | Name |
| address | String | No | Address |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"latitude": "LAT_NUMBER",
"longitude": "LONG_NUMBER",
"name": "Example Name",
"address": "Example Address"
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "location"
} '
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 8. Send contact message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | contacts (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| contacts | List | Yes | Contacts |
contacts param:
| Param | Type | Required | Description |
|---|---|---|---|
| name | Object | Yes | Contact name |
| phones | List | No | Contact phone no. |
name param:
| Param | Type | Required | Description |
|---|---|---|---|
| formatted_name | String | Yes | Full name displayed |
| first_name | String | No | Name |
phones param:
| Param | Type | Required | Description |
|---|---|---|---|
| phone | String | No | Phone no. |
| type | String | No | CELL, MAIN, IPHONE, HOME and WORK are optional |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d ' {
"content": {
"contacts": [{
"name": {
"formatted_name": "NAME",
"first_name": "NAME"
},
"phones": [{
"phone": "PHONE_NUMBER",
"type": "CELL"
}]
}]
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "contacts"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 9. Send button message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | interactive (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| interactive | Object | Yes | Button content |
interactive param:
| Param | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | (button) type |
| body | Object | Yes | Button content |
| action | Object | Yes | Reply button |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"interactive": {
"type": "button",
"body": {
"text": "BUTTON_TEXT"
},
"action": {
"buttons": [{
"type": "reply",
"reply": {
"id": "UNIQUE_BUTTON_ID_1",
"title": "BUTTON_TITLE_1"
}
},
{
"type": "reply",
"reply": {
"id": "UNIQUE_BUTTON_ID_2",
"title": "BUTTON_TITLE_2"
}
}
]
}
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "interactive"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 10. Send list message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | interactive (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| interactive | Object | Yes | List content |
interactive param:
| Param | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | Type (list) |
| header | Object | No | Page header content |
| body | Object | Yes | Body content |
| footer | Object | No | Footer content |
| action | Object | Yes | List content |
action param:
| Param | Type | Required | Description |
|---|---|---|---|
| button | String | Yes | Button content |
| sections | Array | Yes | Price |
sections param:
| Param | Type | Required | Description |
|---|---|---|---|
| title | String | Yes | Title |
| rows | Array | Yes | Select content |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"interactive": {
"type": "list",
"header": {
"type": "text",
"text": "HEADER_TEXT"
},
"body": {
"text": "BODY_TEXT"
},
"footer": {
"text": "FOOTER_TEXT"
},
"action": {
"button": "BUTTON_TEXT",
"sections": [{
"title": "SECTION_1_TITLE",
"rows": [{
"id": "SECTION_1_ROW_1_ID",
"title": "SECTION_1_ROW_1_TITLE",
"description": "SECTION_1_ROW_1_DESCRIPTION"
},
{
"id": "SECTION_1_ROW_2_ID",
"title": "SECTION_1_ROW_2_TITLE",
"description": "SECTION_1_ROW_2_DESCRIPTION"
}
]
},
{
"title": "SECTION_2_TITLE",
"rows": [{
"id": "SECTION_2_ROW_1_ID",
"title": "SECTION_2_ROW_1_TITLE",
"description": "SECTION_2_ROW_1_DESCRIPTION"
},
{
"id": "SECTION_2_ROW_2_ID",
"title": "SECTION_2_ROW_2_TITLE",
"description": "SECTION_2_ROW_2_DESCRIPTION"
}
]
}
]
}
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "interactive"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 11. Send FLOW type message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | interactive (fixed value) |
| content | Object | Yes | Message content |
| context | Object | No | Message context |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| interactive | Object | Yes | List content |
interactive param:
| Param | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | flow |
| header | Object | No | Page header content |
| body | Object | Yes | Body content |
| footer | Object | No | Footer content |
| action | Object | Yes | List content |
header param:
| Param | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | text |
| text | String | Yes | Text content |
body param:
| Param | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Text content |
footer param:
| Param | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Text content |
action param:
| Param | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | flow |
| parameters | Object | Yes | Param |
parameters param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_message_version | String | Yes | Fixed as 3 |
| flow_token | String | Yes | Select content |
| flow_id | String | Yes | Unique ID of the workflow provided by WhatsApp |
| flow_cta | String | Yes | Text on the CTA button. For example: "Register" |
| flow_action | String | Yes | navigate or data_exchange. (Default value: navigate) |
| flow_action_payload | Object | No | This object is required only when flow_action is navigate |
flow_action_payload param:
| Param | Type | Required | Description |
|---|---|---|---|
| screen | String | Yes | id of the first screen of the workflow |
| data | String | No | Input data of the first screen of the workflow. Must be a non-blank object |
context param:
| Param | Type | Required | Description |
|---|---|---|---|
| messageid | String | No | Message ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"interactive": {
"type": "flow",
"header": {
"type": "text",
"text": "HEADER_TEXT"
},
"body": {
"text": "BODY_TEXT"
},
"footer": {
"text": "FOOTER_TEXT"
},
"action": {
"name": "flow",
"parameters": {
"flow_message_version": "3",
"flow_token": "AQAAAAACS5FpgQ_cAAAAAD0QI3s.",
"flow_id": "1",
"flow_cta": "Book!",
"flow_action": "navigate",
"flow_action_payload": {
"screen": "<SCREEN_NAME>",
"data": {
"product_name": "name",
"product_description": "description",
"product_price": 100
}
}
}
}
}
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "interactive"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Return example:
{
"item": {
"contacts": [{
"Input": "+447385911146",
"wa_id": "447385911146"
}],
"messages": [{
"id": "gHTRETHRTHTRTH-av4Y"
}],
"meta": {
"api_status": "stable",
"version": "2.44.0.27"
}
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 12. Send reply message
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| from | String | Yes | Sender |
| to | String | Yes | Receiver |
| type | String | Yes | replyText (fixed value) |
| content | Object | Yes | Message content |
content param:
| Param | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Reply content |
| replyText | String | Yes | ID of message to be replied |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/forword
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"content": {
"text": "this is replyText",
"replyText": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
},
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "replyText"
}'
2
3
4
5
6
7
8
9
10
11
12
13
Return example:
{
"item": {
"messaging_product": "whatsapp",
"messages": [{
"id": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA="
}],
"contacts": [{
"input": "11111111",
"wa_id": "11111111"
}]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# Receive user message
Request URL:
webhook notification message return example, configured in the Sobot Admin Center backend
Warning:
When receiving a user message, the returned parameters include
metaId, which is the message ID returned by the meta tag, andmessageId, which is the message ID corresponding to the "wisdom tooth" (a specific message).When the message body contains a
contextfield, and thecontextobject has anidfield, then the message is a reference reply message.contextis the referenced message object, wherecontext.fromrepresents the referenced message number,context.idrepresents the referenced message ID, andcontext.messageIdrepresents the "wisdom tooth" ID of the referenced message.context.messageIdhas the following possible values:
| from | context.from | context.messageId settings |
|---|---|---|
| Customer WhatsApp Number | Customer WhatsApp Number | Message ID generated by sobot |
| Customer WhatsApp Number | WhatsApp Business Number | Sobot message ID (this message is sent by a business number via the API "/api/whatsapp/v3/forword") / Meta message ID (this message is sent by a business number via the API "/api/whatsapp/forword" or directly through the WhatsApp chat window) |
# ● Text message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"text": "this is text"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "text",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Image message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "image",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● File message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"mediaUrl": "https://img.sobot.com/console/common/face/robot.png",
"filename": "example.txt"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "document",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ● Video message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "video",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Audio message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "audio",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Sticker message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "sticker",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Location message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"latitude": "LAT_NUMBER",
"longitude": "LONG_NUMBER",
"name": "NAME",
"address": "ADDRESS"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "location",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# ● Contact message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"contacts": [
{
"name": {
"formatted_name": "NAME",
"first_name": "NAME"
},
"phones": [
{
"phone": "PHONE_NUMBER",
"wa_id": "8618888888888",
"type": "CELL"
}
]
}
]
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "contacts",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# ● Button message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"button": {
"payload": "No-Button-Payload",
"text": "No",
"messageid": "123456789qazwsxedcrfvhbhsfdgsfgsb"
}
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "button",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# ● Order message
Return example:
{
"content": {
"order": {
"catalog_id": "the-catalog_id",
"text": "text-message-sent-along-with-the-order",
"product_items": [
{
"quantity": "number-of-item",
"product_retailer_id": "the-product-SKU-identifier",
"item_price": "unitary-price-of-item",
"currency": "price-currency"
}
]
}
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "order",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ● Interactive message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"interactive": {
"type": "button_reply",
"button_reply": {
"id": "unique-button-identifier-here",
"title": "button-text"
}
}
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "interactive",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ● Message containing advertisements
Return example:
{
"content": {
"referral": {
"media_type": "image or video",
"video_url": "RAW_VIDEO_URL",
"image_url": "https://img.sobot.com/console/common/face/robot.png",
"source_type": "ad or post",
"source_id": "ADID",
"body": "AD_DESCRIPTION",
"headline": "AD_TITLE",
"source_url": "AD_OR POST_FB URL",
"thumbnail_url": "RAW_THUMBNAIL URL",
"ctwa_clid": "CLIENT_ID"
},
"text": "body"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "text",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ● Flow callback message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"interactive": {
"nfm_reply": {
"name": "flow",
"response_json": "{\"flow_token\":\"unused\",\"screen_0_firstName_0\":\"wang\",\"screen_1_TextInput_1\":\"123\",\"screen_1_TextInput_0\":\"11\",\"screen_0_lastName_1\":\"TESTNAME\"}",
"body": "Sent"
},
"type": "nfm_reply"
}
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "8618210323232",
"name": "TESTNAME",
"to": "110243462020762",
"type": "interactive"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ● Welcome Message callback message
Return example:
{
"content": {
"contacts": [{
"profile": {
"name": "666"
},
"wa_id": "8618518444333"
}]
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "8618210323232",
"name": "TESTNAME",
"to": "110243462020762",
"type": "request_welcome"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Edit message
Return example:
{
"content": {
"context": {
"from": "12073588518",
"id": "wamid.HBgLNjE0ODM5MzczMzAVAgARGBJGMDdERjUwOEIyOUE4QTBGNkYA",
"messageId": "25395b85959f19388370e1bb7106cf4a"
},
"text": "edited message content"
},
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "edit.text",
"name": "NAME"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Revoke message
Return example:
{
"timestamp":"1763449988",
"messageId": "8e22a5b438ef5dc88f634bc056d4dc28",
"metaId": "wamid.HBgNODYxODIxMDMzNTIzNBUCABEYEkQ4RTJGRUI0QTA3MDFEMDY4RAA=",
"from": "FROM_PHONE_NUMBER_ID",
"to": "PHONE_NUMBER",
"type": "revoke",
"name": "NAME"
}
2
3
4
5
6
7
8
9
# WhatsApp Business App Coexistence
# Triggering WhatsApp Business App Historical Data Synchronization
Description: This API requires users to call it within 24 hours of integrating the WhatsApp Business App; otherwise, the WhatsApp Business App number needs to be re-integrated.
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| phone_number_id | String | Yes | WhatsApp Business App phone number ID |
| messaging_product | String | Yes | Requesting products, fixed as whatsapp |
| sync_type | String | Yes | Synchronization types: history - historical messages; smb_app_state_sync - synchronize historical contacts. |
Request example:
curl https://sg.sobot.com/chat-whatsapp/api/whatsapp/syncSmbAppData
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"phone_number_id": "PHONE_NUMBER_ID",
"messaging_product": "whatsapp",
"sync_type": "smb_app_state_sync"
}'
2
3
4
5
6
7
8
Return example:
Success:
{
"item": {
"messaging_product": "whatsapp",
"request_id": "<REQUEST_ID>"
},
"ret_code": "000000",
"ret_msg": "Success"
}
2
3
4
5
6
7
8
Fail:
{
"item": {
"error": {
"code": 135000,
"message": "(#135000) Generic user error",
"type": "OAuthException",
"fbtrace_id": "AR-_cvkNLAOXfaMaqU4W8O8",
"error_data": {
"messaging_product": "whatsapp",
"details": "Synchronization Request made outside of allowed time window: Synchronization request can only be made within 24 hours of onboarding"
}
}
},
"ret_code": "135000",
"ret_msg": "(#135000) Generic user error"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Historical Customer Information from WhatsApp Business App
Description:
The from field is the WhatsApp Business App's phone number ID.
state_sync object:
| Param | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | The default value is contact |
| contact | Object | Yes | WhatsApp customer information |
| action | String | Yes | add remove |
| metadata | Object | Yes | meta data |
contact object:
| Param | Type | Required | Description |
|---|---|---|---|
| full_name | String | Yes | The WhatsApp customer's full name. This field is not included if the WhatsApp Business app user removes the contact from their contacts. |
| first_name | String | Yes | WhatsApp customer name; this field is not included if the WhatsApp Business app user removes the contact from their contacts. |
| phone_number | String | Yes | WhatsApp customer phone number |
metadata object:
| Param | Type | Required | Description |
|---|---|---|---|
| timestamp | String | Yes | A timestamp indicates the time when a contact was added, edited, or removed. |
The metadata.timestamp can take the following values:
When
action = add, the returned timestamp is the time the contact was added or edited.When
action = remove, if the returned timestamp is not 0, it is the time when the contact was removed from the WhatsApp Business app's address book.When
action = remove, if the returned timestamp is 0, it is the deletion status of a contact in the WhatsApp Business app's sync history.
Return example:
{
"from": "1020247171179790",
"type": "smb_app_state_sync",
"content": {
"state_sync": [
[
{
"type": "contact",
"contact": {
"full_name": "SHAWAL",
"first_name": "SHAWAL",
"phone_number": "6580001611"
},
"action": "add",
"metadata": {
"timestamp": "1774444193917"
}
},
{
"type": "contact",
"contact": {
"full_name": "Guest",
"phone_number": "306985231165"
},
"action": "remove",
"metadata": {
"timestamp": "1773296179238"
}
}
]
]
},
"timestamp": 1775379720935
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# WhatsApp Business App Historical Messagee Data Webhook Push
If a merchant has approved the sharing of chat records when creating a coexisting number for the WhatsApp Business App, a series of historical record webhooks will be triggered, containing all messages sent or received within 180 days after the merchant accesses the Cloud API.
Messages in group chats will not be included
Media messages will not include media IDs; however, additional historical record webhooks containing media IDs for such media messages will be sent separately, but only for media messages sent within 14 days after onboarding.
Please note that for efficiency, a single webhook may describe thousands of messages. Therefore, we recommend that you first retrieve its content and then process it asynchronously.
Historical messages can be identified by "type": "history". The actual historical message objects support various message types, whose formats are consistent with those defined in the Receive user message section of the documentation.
Example Payload with Multiple Messages
{
"data": [
{
"metaId": "wamid.HBgNNjI4MTM1MzA2OTQ5NRUCABIYIEFDOTVEMjA3RUE5NkM5NkY5RjZGOTJFMEI0MEQzRjVEAA==",
"messageId": "4fc67d4442fe5afc20ef8cd391f3855b",
"from": "6281353069495",
"to": "639270070621",
"type": "text",
"content": {
"text": "If you need transportation for pick-up and drop-off, you can contact me."
},
"timestamp": "1760250773"
},
{
"metaId": "wamid.HBgNNjI4MTM1MzA2OTQ5NRUCABIYIEFDNEYyNkZBMDg1MjBERDFBOTQ0OUUxRDI2OUQwRDZDAA==",
"messageId": "18594f4526ce510f3cee289de5ac890a",
"from": "6281353069495",
"to": "639270070621",
"type": "text",
"content": {
"text": "Good afternoon"
},
"timestamp": "1760250769"
},
{
"metaId": "wamid.HBgNODYxODkxMDA2ODEwMxUCABEYFjNFQjA2MUUxMzQ4MzY4NkJDNUQxQjMA",
"messageId": "7b5e4f09dac6090fbe3a74eb58a173fe",
"from": "639270070621",
"to": "6285381696739",
"type": "text",
"content": {
"text": "hi ,anyone ?"
},
"timestamp": "1766044050"
},
{
"metaId": "wamid.HBgNODYxODkxMDA2ODEwMxUCABEYFjNFQjA5OTM0RUYxMjkzNkMxRkVBQkMA",
"messageId": "97fc636156649f188848629298509431",
"from": "639270070621",
"to": "6281315230372",
"type": "text",
"content": {
"text": "hi"
},
"timestamp": "1765249615"
}
],
"type": "history"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Media Message Example
{
"data": [
{
"metaId": "wamid.QyNUEHBgLMTY0NjcwNDM1OTUVAgARGBI1Rj3NEYxMzAzMzQ5MkXY",
"messageId": "82b0a0f38b74e6de9232dec243274f4f",
"from": "15550783881",
"to": "639270070621",
"type": "image",
"content": {
"mediaUrl": "https://img-hk.sobot.com/2afeacab09c54f47a77962499364234f/chatres/2afeacab09c54f47a77962499364234f/msg/20260405/c16c616589db4cd98e750f23336ec167/b68bdc8c397a40abb05bbc968f740175.jpeg"
},
"timestamp": "1775374217"
}
],
"type": "history"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Messages from WhatsApp Business App to Customers
Description:
The message structure is exactly the same as Receive user message.
Differences:
- The
tofield value is the WhatsApp customer's number. - The
fromfield value is the WhatsApp Business App's ID. - The
typefield value issmb_message_echoes.{message_type}. smb_message_echoesindicates that the message was sent from the WhatsApp Business App to the WhatsApp customer.{message_type}is the message type sent from the WhatsApp Business App to the WhatsApp customer.
Return example:
{
"metaId": "wamid.HBgMOTIzMjY3ODE4NzQ5FQIAERggQTU1MTgyOUMzNTc3NDM2QUM0QUQyQTI3RTQ0OTQ2QjQA",
"messageId": "2ea810f1bf417287afc252a8bbcee536",
"from": "1020247171179790",
"to": "923267818749",
"type": "smb_message_echoes.text",
"content": {
"text": "*UZAIR SALEEM SUPERVISOR* \n\n *0343 3559656* \n\n *CALL SHOP PAR* *POCHNE SE 2MINT* *PAHLE*"
},
"timestamp": "1775381314"
}
2
3
4
5
6
7
8
9
10
11
# Message template management
# ● Get message template
API description: Retrieve all templates in the current wabaId
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/templateList
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| waba_ids | List | No | The unique ID list of WhatsApp business account |
| phone_numbers | List | No | WhatsApp business number List |
| template_categories | List | No | WhatsApp template category list: AUTHENTICATION, MARKETING, UTILITY |
| template_statuses | List | No | WhatsApp template status list: APPROVED; DISABLED; PAUSED; PENDING; REJECTED |
| template_languages | List | No | WhatsApp template languages, see template_category |
| template_content | String | No | WhatsApp template content can be searched by content or template name (fuzzy search). |
| page_no | Integer | No | Start page (default 1) |
| page_size | Integer | No | Number of records to query (default 15, maximum 1000) |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/templateList
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-H 'language: zh'
-d '{
"waba_ids": [],
"phone_numbers": [],
"template_categories": [
"MARKETING",
"UTILITY"
],
"page_no": 1,
"page_size": 15
}
2
3
4
5
6
7
8
9
10
11
12
13
14
Return example:
{
"item": {
"data": [
{
"components": [
{
"format": "DOCUMENT",
"type": "HEADER",
"example": {
"header_handle": [
"https://scontent.whatsapp.net/v/t61.29466-34/224083690_601486205046207_3953929358019518287_n.pdf?ccb=1-7&_nc_sid=57045b&_nc_ohc=ANcodTypUrsAX_c3ME8&_nc_ht=scontent.whatsapp.net&edm=AH51TzQEAAAA&oh=01_AdRen_9v352EcZ7FFjoA6bVf0fUODwqoIfRjDa1PE0Uicw&oe=63931F4C"
]
}
},
{
"text": "This is {{1}} content, and also have {{2}} params.",
"type": "BODY",
"example": {
"body_text": [
[
"rick",
"2"
]
]
}
},
{
"text": "this is footer",
"type": "FOOTER"
},
{
"buttons": [
{
"phone_number": "+86184xxxx7413",
"text": "call me",
"type": "PHONE_NUMBER"
},
{
"text": "chat page",
"type": "URL",
"url": "https//xxx.html?name=text&partnerid={{1}}",
"example": [
"https//xxx.html?name=text&partnerid=1234"
]
}
],
"type": "BUTTONS"
}
],
"last_update_time": 1765178480,
"name": "templates_test",
"language": "zh_CN",
"id": "601486201712874",
"rejected_reason": "NONE",
"quality_score": {
"date": "175****859",
"score": "UNKNOWN"
},
"category": "TRANSACTIONAL",
"status": "APPROVED"
}
],
"namespace": "9eb0ceda_9fc9_42ad_ad5a_5dd9d905a15a"
},
"page_count": 1,
"page_no": 1,
"page_size": 10,
"total_count": 1,
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
| page_no | Integer | Yes | Start page (default 1) |
| page_size | Integer | Yes | Query count (default to querying all templates) |
| page_count | Integer | Yes | Query page count |
| total_count | Integer | Yes | Total count |
item object:
| Param | Type | Description |
|---|---|---|
| namespace | String | Template namespace |
| id | String | Template code |
| name | String | Template name |
| language | String | Template language |
| status | String | Template status |
| category | String | Template category |
| components | List | Template content |
| rejected_reason | String | Template rejected reason |
| quality_score | Object | Template quality score |
| last_update_time | Long | Template last update time |
# ● Create message template
API description: create message template
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| wabaid | String | Yes | The unique ID of WhatsApp business account |
| name | String | Yes | Template name |
| category | String | Yes | Template category (options: UTILITY, MARKETING, AUTHENTICATION) |
| language | String | Yes | Template language code |
| components | List | Yes | Template content |
For more template parameter information, you can view in WhatsApp Business API (opens new window)
For languages available for template, you can query in Available Language - WhatsApp Business API (opens new window)
- Request example: 1. Create a message template request example for MARKETING
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"name": "seasonal_promotion",
"language": "en_US",
"wabaid": "123456789",
"category": "MARKETING",
"components": [{
"type": "HEADER",
"format": "TEXT",
"text": "Our {{1}} is on!",
"example": {
"header_text": [
"Summer Sale"
]
}
},
{
"type": "BODY",
"text": "Shop now through {{1}} and use code {{2}} to get {{3}} off of all merchandise.",
"example": {
"body_text": [
[
"the end of August", "25OFF", "25%"
]
]
}
},
{
"type": "FOOTER",
"text": "Use the buttons below to manage your marketing subscriptions"
},
{
"type": "BUTTONS",
"buttons": [{
"type": "QUICK_REPLY",
"text": "Unsubscribe from Promos"
},
{
"type": "QUICK_REPLY",
"text": "Unsubscribe from All"
}
]
}
]
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
- Request example for creating message template with Flow
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '
{
"wabaid": "123456789",
"name": "template_name",
"language": "LANGUAGE_AND_LOCALE_CODE",
"category": "MARKETING",
"components": [
{
"type": "body",
"text": "This is a flows as template demo"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "FLOW",
"text": "Open flow!",
"flow_id": "<flow-id>",
"navigate_screen": "Flows Json screen name",
"flow_action": "navigate"
}
]
}
]
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- Create a message template request example for AUTHENTICATION
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '
{
"category": "AUTHENTICATION",
"message_send_ttl_seconds": 360,
"components": [{
"example": {
"body_text": [
[
"123456"
]
]
},
"add_security_recommendation": true,
"type": "BODY"
},
{
"code_expiration_minutes": 5,
"type": "FOOTER"
},
{
"type": "BUTTONS",
"buttons": [{
"type": "otp",
"otp_type": "copy_code"
}]
}
],
"language": "en_US",
"name": "template_name",
"wabaid": "123456778"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- Create a message template with a header
4.1 Files and buttons
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"name": "document_demo001",
"language": "en_US",
"wabaid": "1234567890",
"category": "MARKETING",
"components": [{
"type": "HEADER",
"format": "document",
"example": {
"header_handle": [
"4::XXX:YYYY-AAAA:e:11:22:33:OOOO"
]
}
},
{
"type": "BODY",
"text": "Nice to meet you{{1}}! My number is {{2}}. ",
"example": {
"body_text": [
[
"Pablo", "86123456789"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [{
"type": "PHONE_NUMBER",
"text": "Call",
"phone_number": "86123456789"
},
{
"type": "URL",
"text": "Contact Support",
"url": "https://xxx.com"
}
]
}
]
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
4.2 Videos and buttons
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"name": "video_demo001",
"language": "en_US",
"wabaid": "1234567890",
"category": "MARKETING",
"components": [{
"type": "HEADER",
"format": "VIDEO",
"example": {
"header_handle": [
"4::XXX:YYYY-AAAA:e:11:22:33:OOOO"
]
}
},
{
"type": "BODY",
"text": "Nice to meet you{{1}}! My number is {{2}}. ",
"example": {
"body_text": [
[
"Pablo", "86123456789"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [{
"type": "PHONE_NUMBER",
"text": "Call",
"phone_number": "86123456789"
},
{
"type": "URL",
"text": "Contact Support",
"url": "https://xxx.com"
}
]
}
]
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
4.3 Images and buttons
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"name": "image_demo001",
"language": "en_US",
"wabaid": "1234567890",
"category": "MARKETING",
"components": [{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [
"4::XXX:YYYY-AAAA:e:11:22:33:OOOO"
]
}
},
{
"type": "BODY",
"text": "Nice to meet you{{1}}! Your order number is {{2}}. it is great.",
"example": {
"body_text": [
[
"Pablo", "1234567890"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [{
"type": "PHONE_NUMBER",
"text": "Call",
"phone_number": "86123456789"
},
{
"type": "URL",
"text": "Contact Support",
"url": "https://xxx.com"
}
]
}
]
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Return example:
{
"item": {
"id": "43182111222804988"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
# ● Delete message template
API description: If the message template of this name has multiple language versions, all language versions will be deleted.
Request method:
GET
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/deleteTemplate
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| wabaid | String | Yes | The unique ID of WhatsApp business account |
| template_name | String | Yes | Template name |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/deleteTemplate?wabaid=12345&template_name=test
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
2
Return example:
{
"item": {
"success": true
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | boolean | true: Deleted |
# ● Update message template
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/updateTemplateInfo?templateid=1*****5
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| templateid | String | YES | Template id |
| category | String | NO | Template category |
| components | List | NO | Template components |
| message_send_ttl_seconds | Integer | NO | Template message send ttl seconds |
| parameter_format | String | NO | Template parameter format |
Request example:
{
"category": "MARKETING",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "a****d"
},
{
"type": "BODY",
"text": "hi,****."
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "FLOW",
"text": "aa****v",
"flow_id": "829****88320",
"flow_action": "NAVIGATE",
"navigate_screen": "wu****nx",
"icon": "REVIEW"
}
]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Return example:
{
"item": {
"success": true,
"name": "wu****evhk",
"id": "13173****762808",
"category": "MARKETING"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | boolean | true: Updated |
# WhatsApp Flows API
Flows API supports various operations for flows.
# ● Create Flow
API description: Create a new Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/create
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| waba_id | String | Yes | WhatsApp Business Account ID |
| name | String | Yes | Flow name |
| categories | Array | Yes | Flow categories, optional values: SIGN_UP,SIGN_IN,APPOINTMENT_BOOKING,LEAD_GENERATION,CONTACT_US,CUSTOMER_SUPPORT,SURVEY,OTHER |
| flow_json | String | No | Flow JSON content |
| clone_flow_id | String | No | Flow ID for cloning |
| endpoint_uri | String | No | Endpoint URI |
| publish | Boolean | No | Whether to publish, default is false |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/create' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802' \
--header 'Content-Type: application/json' \
--data-raw '{
"waba_id": "41500772752xxxx",
"flow_json": "{\"version\":\"5.0\",\"screens\":[{\"id\":\"WELCOME_SCREEN\",\"layout\":{\"type\":\"SingleColumnLayout\",\"children\":[{\"type\":\"TextHeading\",\"text\":\"Hello World\"},{\"type\":\"Footer\",\"label\":\"Complete\",\"on-click-action\":{\"name\":\"complete\",\"payload\":{}}}]},\"title\":\"Welcome\",\"terminal\":true,\"success\":true,\"data\":{}}]}",
"name": "Test flow",
"categories": [
"SIGN_UP"
],
"publish": true
}'
2
3
4
5
6
7
8
9
10
11
12
Return example:
{
"page_no": null,
"page_count": null,
"total_count": null,
"page_size": null,
"items": null,
"item": {
"id": "667b61324d93axxxxxxx",
"name": "Test flow",
"status": "DRAFT"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| id | String | Flow ID |
| name | String | Flow name |
| status | String | Flow status |
# ● Get Flow List
API description: Get Flow list under specified wabaId
Request method:
GET
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/list
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| waba_id | String | Yes | WhatsApp Business Account ID |
| limit | Integer | No | Number of queried records |
Request example:
curl --location --request GET 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/list?waba_id=415007727522xxxx' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802'
2
Return example:
{
"page_no": null,
"page_count": null,
"total_count": null,
"page_size": null,
"items": null,
"item": {
"data": [
{
"name": "Third bird",
"validation_errors": [],
"categories": [
"OTHER"
],
"id": "1161384655981930",
"status": "DRAFT"
},
{
"name": "Second Flow",
"validation_errors": [],
"categories": [
"OTHER"
],
"id": "25272671695750248",
"status": "DEPRECATED"
},
{
"name": "first-flow-create-update-after",
"validation_errors": [
{
"error_type": "FLOW_JSON_ERROR",
"column_end": 35,
"column_start": 30,
"error": "INVALID_FLOW_JSON_VERSION",
"message": "Given Flow JSON version is not supported. Please refer the supported versions at https://developers.facebook.com/docs/whatsapp/flows/changelogs#currently-supported-versions.",
"line_start": 2,
"line_end": 2
}
],
"categories": [
"CONTACT_US",
"CUSTOMER_SUPPORT"
],
"id": "1361387441788642",
"status": "DRAFT"
}
]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| data | Array | Flow data list |
data object:
| Param | Type | Description |
|---|---|---|
| id | String | Flow ID |
| name | String | Flow name |
| status | String | Flow status: DRAFT, PUBLISHED, DEPRECATED |
| categories | Array | Flow category list |
| validation_errors | Array | Validation error list |
validation_errors object:
| Param | Type | Description |
|---|---|---|
| error | String | Error code |
| error_type | String | Error type |
| message | String | Error message |
| line_start | Integer | Error start line |
| line_end | Integer | Error end line |
| column_start | Integer | Error start column |
| column_end | Integer | Error end column |
| pointers | Array | Error position pointer list |
pointers object:
| Param | Type | Description |
|---|---|---|
| line_start | Integer | Error start line |
| line_end | Integer | Error end line |
| column_start | Integer | Error start column |
| column_end | Integer | Error end column |
| path | String | Error position path |
# ● Update Flow Metadata
API description: Update metadata of specified Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/update/metadata
Body param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
| endpoint_uri | String | No | Endpoint URI |
| name | String | No | Flow name |
| categories | Array | No | Flow categories, optional values: SIGN_UP,SIGN_IN,APPOINTMENT_BOOKING,LEAD_GENERATION,CONTACT_US,CUSTOMER_SUPPORT,SURVEY,OTHER |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/update/metadata' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802' \
--header 'Content-Type: application/json' \
--data-raw '{
"flow_id":"86452410282xxxx",
"endpoint_uri": "http://example.sobot.com/example",
"name": "netadata 25567",
"categories": [
"SURVEY"
]
}'
2
3
4
5
6
7
8
9
10
11
Return example:
{
"item": {
"success": true
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | Boolean | Whether update is successful |
# ● Update Flow JSON Content
API description: Update JSON content of specified Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/update/assets
Body param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
| file | File | Yes | Flow JSON file |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/update/assets' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802' \
--form 'flow_id="86452410282xxxx"' \
--form 'file=@"C:\\Users\\Administrator\\Desktop\\flow.json"'
2
3
4
Return example:
{
"item": {
"success": true,
"validation_errors": [
{
"error_type": "FLOW_JSON_ERROR",
"column_end": 17,
"column_start": 12,
"error": "INVALID_FLOW_JSON_VERSION",
"message": "Given Flow JSON version is not supported. Please refer the supported versions at https://developers.facebook.com/docs/whatsapp/flows/changelogs#currently-supported-versions.",
"line_start": 1,
"line_end": 1,
"pointers": [
{
"path": "version",
"column_end": 17,
"column_start": 12,
"line_start": 1,
"line_end": 1
}
]
}
]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | Boolean | Whether update is successful |
| validation_errors | Array | Validation error list |
validation_errors object:
| Param | Type | Description |
|---|---|---|
| error | String | Error code |
| error_type | String | Error type |
| message | String | Error message |
| line_start | Integer | Error start line |
| line_end | Integer | Error end line |
| column_start | Integer | Error start column |
| column_end | Integer | Error end column |
| pointers | Array | Error position pointer list |
pointers object:
| Param | Type | Description |
|---|---|---|
| line_start | Integer | Error start line |
| line_end | Integer | Error end line |
| column_start | Integer | Error start column |
| column_end | Integer | Error end column |
| path | String | Error position path |
# ● Delete Flow
API description: Delete specified Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/delete
Body param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/delete' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802'\
--header 'Content-Type: application/json' \
--data-raw '{
"flow_id":"864524102829823"
}'
2
3
4
5
6
Return example:
{
"item": {
"success": true
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | Boolean | Whether delete is successful |
# ● Get Flow Details
API description: Get detailed information of specified Flow
Request method:
GET
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/detail
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
Request example:
curl --location --request GET 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/detail?flow_id=1202468784689848' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802'
2
Return example:
{
"item": {
"name": "Test change netadata",
"validation_errors": [
{
"error_type": "FLOW_JSON_ERROR",
"column_end": 17,
"column_start": 12,
"error": "INVALID_FLOW_JSON_VERSION",
"message": "Given Flow JSON version is not supported. Please refer the supported versions at https://developers.facebook.com/docs/whatsapp/flows/changelogs#currently-supported-versions.",
"line_start": 1,
"line_end": 1,
"pointers": [
{
"path": "version",
"column_end": 17,
"column_start": 12,
"line_start": 1,
"line_end": 1
}
]
}
],
"id": "1361387441788642",
"categories": [
"SURVEY"
],
"json_version": "5.0",
"whatsapp_business_account": {
"message_template_namespace": "96ecd9d2_e41f_4a64_9942_38210d0a89e1",
"name": "whw",
"timezone_id": "13",
"currency": "AUD",
"id": "4150077275224383"
},
"status": "DRAFT"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| id | String | Flow ID |
| name | String | Flow name |
| status | String | Flow status |
| categories | Array | Flow category list |
| json_version | String | JSON version |
| validation_errors | Array | Validation error list |
| whatsapp_business_account | Object | WhatsApp Business Account information |
validation_errors object:
| Param | Type | Description |
|---|---|---|
| error | String | Error code |
| error_type | String | Error type |
| message | String | Error message |
| line_start | Integer | Error start line |
| line_end | Integer | Error end line |
| column_start | Integer | Error start column |
| column_end | Integer | Error end column |
| pointers | Array | Error position pointer list |
pointers object:
| Param | Type | Description |
|---|---|---|
| line_start | Integer | Error start line |
| line_end | Integer | Error end line |
| column_start | Integer | Error start column |
| column_end | Integer | Error end column |
| path | String | Error position path |
whatsapp_business_account object:
| Param | Type | Description |
|---|---|---|
| id | String | WhatsApp Business Account ID |
| name | String | WhatsApp Business Account name |
| message_template_namespace | String | Message template namespace |
| timezone_id | String | Timezone ID |
| currency | String | Currency code |
# ● Publish Flow
API description: Publish specified Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/publish
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/publish' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802'\
--header 'Content-Type: application/json' \
--data-raw '{
"flow_id":"864524102829823"
}'
2
3
4
5
6
Return example:
{
"item": {
"success": true
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | Boolean | Whether publish is successful |
# ● Deprecate Flow
API description: Deprecate specified Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/deprecate
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/deprecate' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802'\
--header 'Content-Type: application/json' \
--data-raw '{
"flow_id":"864524102829823"
}'
2
3
4
5
6
Return example:
{
"item": {
"success": true
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| success | Boolean | Whether deprecate is successful |
# ● Generate Flow Preview URL
API description: Generate preview URL for Flow
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/preview
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| flow_id | String | Yes | Flow ID |
| fields | String | No | Optional: preview.invalidate(false) Whether to invalidate current preview URL, default is false |
Request example:
curl --location --request POST 'https://sg.sobot.com/chat-whatsapp/api/whatsapp/flows/preview' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802'\
--header 'Content-Type: application/json' \
--data-raw '{
"flow_id":"86452410282xxxx",
"fields":"preview.invalidate(true)"
}'
2
3
4
5
6
7
8
Return example:
{
"item": {
"preview": {
"expires_at": "2026-01-23T09:10:46+0000",
"preview_url": "https://business.facebook.com/wa/manage/flows/1361387441788642/preview/?token=68b7c8fb-a28c-43cd-955a-ab5bfcfb7144"
},
"id": "1361387441788642"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| item | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| id | String | Flow ID |
| preview | Object | Preview information |
preview object:
| Param | Type | Description |
|---|---|---|
| expires_at | String | Preview URL expiration time |
| preview_url | String | Preview URL |
# Webhook status notification
Request URL:
webhook notification message return example, configured in the Sobot Admin Center backend
# ● Message sending status notification
| Status attribute | Status meaning |
|---|---|
| sent | Sent |
| delivered | Delivered |
| read | Read |
| failed | Sending failed |
Return example:
{
"errorCode": "",
"errorTitle": "",
"from": "FROM_PHONE_NUMBER_ID",
"messageId": "wamid.HBgNNTIxNjE0MjEwNjE1MhUCABEYEjhDQzc2RjNENjIwMjVGODA3RQA=",
"metaId": "wamid.HBgNNTIxNjE0MjEwNjE1MhUCABEYEjhDQzc2RjNENjIwMjVGODA3RQA=",
"status": "sent",
"timestamp": "1667453467",
"to": "PHONE_NUMBER",
"type": "status",
"pricing": {
"type": "regular",
"pricing_model": "PMP",
"category": "marketing"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ● Template message status notification
# 1. Approval status change
Return example:
{
"entry": [{
"id": "100564172792081",
"time": 1689846344,
"changes": [{
"field": "message_template_status_update",
"value": {
"event": "APPROVED",
"message_template_id": 12345678,
"message_template_name": "my_message_template",
"message_template_language": "pt-BR",
"reason": "NONE"
}
}]
}],
"object": "whatsapp_business_account"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 2. Quality change
Return example:
{
"entry": [{
"id": "100564172792081",
"time": 1689847615,
"changes": [{
"field": "message_template_quality_update",
"value": {
"previous_quality_score": "GREEN",
"new_quality_score": "YELLOW",
"message_template_id": 12345678,
"message_template_name": "my_message_template",
"message_template_language": "pt-BR"
}
}]
}],
"object": "whatsapp_business_account"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Template category update notification
# 1. Template category update notice
Return example:
{
"entry": [{
"id": "100564172792081",
"time": 1689847615,
"changes": [{
"field": "template_category_update",
"value": {
"correct_category": "MARKETING",
"new_category": "UTILITY",
"message_template_id": 12345678,
"message_template_name": "my_message_template",
"message_template_language": "pt-BR"
}
}]
}],
"object": "whatsapp_business_account"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Description: Receiving this callback indicates that the template will change from the category type corresponding to new_category to the category type corresponding to correct_category within 24 hours. New_category represents the current category of the template, while correct_category represents the category that the template will become.
# 2. Template category update
Return example:
{
"entry": [{
"id": "100564172792081",
"time": 1689847615,
"changes": [{
"field": "template_category_update",
"value": {
"previous_category": "UTILITY",
"new_category": "MARKETING",
"message_template_id": 12345678,
"message_template_name": "my_message_template",
"message_template_language": "pt-BR"
}
}]
}],
"object": "whatsapp_business_account"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Description: Upon receiving this callback, if the message contains both the preview_category field and the new_category field, it indicates that the template has changed from the category type corresponding to preview_category to the category type corresponding to new_category. Previous_category represents the previous category of the template, while new_category represents the current category of the template; If the message only contains the new_category field, it means that the corresponding template was immediately recognized by meta as belonging to the category corresponding to new_category.
# ● Account status
# 1. Account quality update
Return example:
{
"entry": [{
"id": "1111111111111",
"time": 1689927355,
"changes": [{
"field": "phone_number_quality_update",
"value": {
"display_phone_number": "1234567890",
"event": "FLAGGED",
"current_limit": "TIER_10K"
}
}]
}],
"object": "whatsapp_business_account"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 2. Account status update
Return example:
{
"entry": [{
"id": "1111111111",
"time": 1690179982,
"changes": [{
"field": "account_update",
"value": {
"phone_number": "111111111",
"event": "VERIFIED_ACCOUNT"
}
}]
}],
"object": "whatsapp_business_account"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# Upload media attachments - used to create message templates
API description: Upload media attachments - used to create message templates
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/get_handle_id
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| importUrl | String | Yes | MediaUrl |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| item | String | header_handle |
Request example:
curl -H 'token: 4ac37cb2e9c740dba4b75a34d5358802' https://sg.sobot.io/chat-whatsapp/api/whatsapp/get_handle_id?importUrl=https://xxxxx.com/image/20230323165317730.jpg
Return example:
{
"page_no": null,
"page_count": null,
"total_count": null,
"page_size": null,
"items": null,
"item": "4::2==:1-1:e:1730433757:1134351617166827:2:3",
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
# Upload media attachments - used to send media messages
API description: Upload media attachments - used to send media messages
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/media_upload
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| phone_numberid | String | Yes | |
| url | String | Yes | Media attachment path |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Yes |
| ret_msg | String | Yes |
| item | Object | No |
item object: | Param | Type | Description || ------- |---------|------------------------|| id | String | Yes | Media ID |
Request example:
curl -H 'token: 4ac37cb2e9c740dba4b75a34d5358802' https://sg.sobot.io/chat-whatsapp/api/whatsapp/media_upload?phone_numberid=1102434620&url=https://sg.sobot.io/console/c72d7e67c0f64d38879/kb/file/d736d26d756e420eac7ef8a6fe4d934f.mp4
Return example:
{
"item": {
"id": "1011461420318338"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
# Query mass messaging task data
API description: Query mass messaging task data
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/api_query_task_list
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| task_start_time | String | No | Task start time (format: 2024-04-29 18:18:18) |
| task_end_time | String | No | Task end time (format: 2024-04-29 18:18:18) |
| sender | String | No | sender |
| template_name | String | No | Template name |
| template_category | String | No | Template category (see: template_category param) |
| template_language | String | No | Template language (see: template_language param) |
| templateid | String | No | Template ID |
| task_status | Integer | No | (1. Not started 2. In progress 3. Ended) |
| task_name | String | No | Task name |
| subjectid | String | No | Marketing theme ID |
| page_no | Integer | Yes | Start page (default 1) |
| page_size | Integer | Yes | Query count (default 15, max 100) |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| items | Object | Return object |
| page_count | String | Total pages |
| page_no | String | Current page |
| page_size | String | Pieces on each page |
| total_count | String | Total pieces |
items object:
| Param | Type | Description |
|---|---|---|
| task_name | String | Task name |
| task_status | Integer | Task status |
| task_source | Integer | Task source (1. whatsapp 2. crm) |
| taskid | Integer | Task ID |
| time_zone | String | Time Zone |
| template_category | String | Template category |
| template_language | String | Template language |
| template_name | String | Template name |
| templateid | String | Template ID |
| task_start_time | String | Task start time |
| task_end_time | String | Task end time |
| send_time_type | Integer | 1. Send now 2. Timed sending |
| estimate_send_num | Long | Estimated sending |
| send_success_num | Long | Sent |
| send_error_num | Long | Sending failed |
| already_send_num | Long | Delivered |
| already_read_num | Long | Read |
| click_button_num | Long | No. of messages with buttons clicked |
| reply_data_num | Long | Reply No. |
| subjectid | String | Marketing theme ID |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/api_query_task_list
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-H 'language: zh'
-d '{
"page_no": 1,
"page_size": 15,
"task_start_time": "2024-03-29 00:00:00",
"task_end_time": "2024-04-29 00:00:00",
"sender": "123456",
"template_category": "AUTHENTICATION",
"template_language": "en_US",
"templateid": "1234567890",
"task_status": 3,
"task_name": "test",
"subjectid": "12345678"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Return example:
{
"items": [
{
"task_name": "1233",
"estimate_send_num": 1,
"task_status": 3,
"task_source": 1,
"taskid": 1759,
"reply_data_num": 0,
"time_zone": "GMT+08:00",
"task_start_time": "2024-04-28 13:32:30",
"click_button_num": 0,
"send_error_num": 1,
"template_category": "MARKETING",
"template_name": "sample_purchase_feedback",
"task_end_time": "2024-04-28 13:33:00",
"send_success_num": 0,
"templateid": "1136323480647385",
"already_send_num": 0,
"send_time_type": 1,
"template_language": "en_US",
"already_read_num": 0,
"subjectid": "12345678"
},
{
"task_name": "123321",
"estimate_send_num": 5,
"task_status": 3,
"task_source": 1,
"taskid": 1740,
"reply_data_num": 0,
"time_zone": "GMT+08:00",
"task_start_time": "2024-04-18 11:59:54",
"click_button_num": 0,
"send_error_num": 5,
"template_category": "UTILITY",
"template_name": "lgtest0804",
"task_end_time": "2024-04-18 12:00:00",
"send_success_num": 0,
"templateid": "986766405895201",
"already_send_num": 0,
"send_time_type": 1,
"template_language": "zh_CN",
"already_read_num": 0,
"subjectid": "12345678"
}
],
"page_count": 14,
"page_no": 1,
"page_size": 2,
"ret_code": "000000",
"ret_msg": "success",
"total_count": 28
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Query sending records
API description: Query sending record data
Request method:
POST
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/send_record_list
Warning:
This API has a call frequency limit of a maximum of 20 calls per minute.
For your first request, please start your search from page 1. Previously queried pages have a 10-minute validity period during which you can re-query using the same criteria. Unqueried pages cannot be queried across pages.
Examples:
If you are currently querying page 7, you can continue querying pages 1-6 with the same search criteria within 10 minutes, but you are not allowed to query page 9 or later.
If you are currently querying page 7, but 10 minutes have passed, you must start your search again from page 1.
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| message_direction | String | No | Message direction(outbound message: outbound ,inbound message: inbound) [Default: outbound] |
| send_start_time | Long | No | Sending start time (e.g. 1714295033250) |
| send_end_time | Long | No | Sending end time (e.g. 1714295033250) |
| messageid | String | No | Message ID |
| message_status | String | No | Message status (see: message_status param) |
| taskid | Integer | No | Task ID |
| task_name | String | No | Task name |
| send_agentid | String | No | Sender |
| sender | String | No | WhatsApp Business Number |
| template_name | Integer | No | Template name |
| template_language | String | No | Template language (see: template_language param) |
| recipient_tel | String | No | Receiver number |
| subjectid | String | No | Marketing theme ID |
| region | String | No | Customer Region(see: region) |
| send_source | Integer | No | Message send source(see: send_source) |
| message_category | String | No | Outbound message category(see: message_category) |
| page_no | Integer | Yes | Start page (default 1) |
| page_size | Integer | Yes | Query count (default 15, max 1000) |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| items | Object | Return object |
| page_count | String | Total pages |
| page_no | String | Current page |
| page_size | String | Pieces on each page |
| total_count | String | Total pieces |
items object:
| Param | Type | Description |
|---|---|---|
| task_name | String | Task name ,this field has a value only for outbound messages |
| error_code | String | Error Code ,this field has a value only for outbound messages |
| timezone | String | Time Zone ,this field has a value only for outbound messages |
| regionid | String | Region ID |
| messageid | String | Message ID |
| taskid | String | Task ID,this field has a value only for outbound messages |
| recipient_tel | String | Customer WhatsApp Number |
| send_agentid | String | Sender |
| template_category | String | Template category,this field has a value only for outbound messages |
| message_status | String | Message status |
| template_name | String | Template name,this field has a value only for outbound messages |
| send_time | Long | Sending time |
| partnerid | String | Docking ID |
| sender | String | WhatsApp Business Number |
| templateid | String | Template ID |
| region | String | Customer Region |
| businessid | String | Business ID |
| status_update_time | Long | Status update time |
| subjectid | String | Marketing theme ID |
| message_category | String | Message category ,this field has a value only for outbound messages |
| send_source | Integer | Message send source ,this field has a value only for outbound messages |
| delivered_time | Long | Message delivery time in milliseconds ,this field has a value only for outbound messages |
| read_time | Long | Message read time in milliseconds ,this field has a value only for outbound messages |
| message_content | String | Message content |
| is_charged | Integer | Whether to charge or not; this field only has a value for outbound messages (1 represents charging, null or 0 represents no charging). |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/send_record_list
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-H 'language: zh'
-d '{
"page_no": 1,
"page_size": 15,
"send_start_time": "1714295033250",
"send_end_time": "1714295033250",
"sender": "123456",
"messageid": "wamid.HBgNODYxO1234AFFEFEWEFEWTUyMDM12345A=",
"template_language": "en_US",
"template_name": "test",
"task_status": 3,
"send_agentid":"4ac37cb2e9c740dba4b75a34d5358802",
"recipient_tel":"12345678,
"message_status":"2",
"taskid": 15,
"task_name": "test",
"subjectid": "12345678"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Return example:
{
"items": [
{
"task_name": "test",
"error_code": "100",
"timezone": "GMT+08:00",
"region": "OTHER",
"taskid": 1732,
"recipient_tel": "11",
"send_agentid": "56a9063a0e8f4ef0aa21edcb7a692da2",
"template_category": "MARKETING",
"message_status": "9",
"template_name": "sample_issue_resolution",
"send_time": 1713247680329,
"partnerid": "MTFfMTA0M1fda1NzUyNTUx",
"sender": "8618435117413",
"templateid": "1073729713514860",
"businessid": "",
"status_update_time": 1713247680329,
"subjectid": "12345678"
},
{
"task_name": "test2",
"error_code": "000000",
"timezone": "GMT+08:00",
"region": "CN",
"messageid": "wamid.HBgNODYxadfasdfasfasf1fdsfdsaCNDM4NEU4RkNFRQA=",
"taskid": 1732,
"recipient_tel": "8615369303026",
"send_agentid": "56a9063a0e8f4ef0aa21edcb7a692da2",
"template_category": "MARKETING",
"message_status": "0",
"template_name": "sample_issue_resolution",
"send_time": 1713247680634,
"partnerid": "ODYxNTM2fasdfAzMjU3NTI1NTE=",
"sender": "8618435117413",
"templateid": "1073729713514860",
"businessid": "123",
"status_update_time": 1713247683305,
"subjectid": "12345678"
}
],
"page_no": 1,
"page_size": 15,
"ret_code": "000000",
"ret_msg": "success",
"total_count": 2
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ● Number management
# 1.Query Meta Number Information List
API description: Query Meta Number Information List,Maximum return of 200 number information。
Request method:
GET
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/qetMetaNumberList?wabaid=123****90
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| wabaid | String | YES | The unique ID of WhatsApp business account |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| item | Object | Object |
items object:
| Param | Type | Description |
|---|---|---|
| id | String | Meta phone number Id |
| waba_id | String | The unique ID of WhatsApp business account |
| messaging_limit_tier | String | Messaging limit_tier |
| display_phone_number | String | Display phone number |
| quality_score | Object | Phone number quality score |
| verified_name | String | Phone number verified name |
| throughput | Object | Phone number throughput |
| code_verification_status | String | Code verification status |
Return example:
{
"item": {
"data": [
{
"messaging_limit_tier": "TIER_1K",
"display_phone_number": "+63 ******* 4375",
"quality_score": {
"score": "GREEN"
},
"verified_name": "*******-dev-0918-HK",
"id": "80585*******72",
"throughput": {
"level": "STANDARD"
},
"code_verification_status": "EXPIRED",
"waba_id": "13401*******8661"
},
{
"display_phone_number": "+66*******1640",
"verified_name": "*******-dev-0918-HK",
"id": "79429*******668",
"throughput": {
"level": "NOT_APPLICABLE"
},
"code_verification_status": "NOT_VERIFIED",
"waba_id": "1340*******18661"
}
]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 2.Apply MMlite API
API description: Apply for MMlite API using Meta business Id.
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/applyMMLiteApi
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| bmid | String | YES | Meta business Id |
Request example:
{
"bmid": "1834*****595"
}
2
3
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| item | Object | Object |
items object:
| Param | Type | Description |
|---|---|---|
| apply_status | String | apply_status 1-NOT APPLIED,2-IN_PROGRESS,3-APPROVED,4-REJECTED |
| bmid | String | Meta business Id |
| reject_reason | String | Reject reason |
| timestamp | Long | Timestamp |
Return example:
{
"item": {
"apply_status": 3,
"bmid": "183*****4595",
"reject_reason": " ",
"timestamp": "176*****548"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
# 3.Update Number API Type
API description: Change number type,default is CLOUD API.
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/updatePhoneNumberApiType
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| api_type | Integer | YES | API type,1-CLOUD API, 2-MMlite API |
| phone_numbers | String[] | YES | Waba phone number array |
Request example:
{
"phone_numbers": [
"112335******452"
],
"api_type": 2
}
2
3
4
5
6
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| item | Object | Object |
items object:
| Param | Type | Description |
|---|---|---|
| api_type | Integer | API type,1-CLOUD API, 2-MMlite API |
| timestamp | Long | Timestamp |
Return example:
{
"item": {
"api_type": 2,
"timestamp": "1762******283"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
# 4.Query number API type
API description: API type for querying numbers,default is CLOUD API.
Request method:
GET
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/queryPhoneNumberApiTypeList
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| wabaid | String | NO | The unique ID of WhatsApp business account |
| phone_numbers | String[] | NO | Waba phone number array |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| item | Object | Object |
items object:
| Param | Type | Description |
|---|---|---|
| api_type | Integer | API type,1-CLOUD API, 2-MMlite API |
| bm_name | String | Meta business name |
| bmid | String | Meta business Id |
| business_page_name | String | Business page name |
| companyid | String | Company Id |
| phone_number | String | Waba phone number |
| timestamp | Long | Timestamp |
| wabaid | String | The unique ID of WhatsApp business account |
Return example:
{
"items": [
{
"api_type": 2,
"bm_name": "S******ot Dev",
"bmid": "526******8760",
"business_page_name": "******-dev-0918-HK",
"companyid": "2afeacab******64234f",
"phone_number": "80585******972",
"timestamp": 0,
"wabaid": "13401******8661"
}
],
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# webhook callback exception query
API description: webhook callback exception query
Request method:
POST
Request URL:
https://sg.sobot.io/chat-set/api/webhook/response_list
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| product_type | String | No | Product type (WhatsApp, Facebook, Line) |
| sender | String | No | Sender |
| http_code | int | No | http response code |
| push_start_time | Long | No | Push start time [default query for the last 7 days] |
| push_end_time | Long | No | Push end time [default query for the last 7 days] |
| response_start_time | Long | No | Response start time [default query for the last 7 days] |
| response_end_time | Long | No | Response end time [default query for the last 7 days] |
| page_no | Integer | No | Start page (default 1) |
| page_size | Integer | No | Pieces queried (default 15) |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| items | List | Return object |
| page_count | Integer | Total pages |
| page_no | Integer | Start page |
| page_size | Integer | Pieces |
| total_count | Integer | Total pieces |
items object:
| Param | Type | Description |
|---|---|---|
| configid | String | Data Id |
| product_type | String | Product type |
| sender | String | Sender |
| webhook_url | String | Webhook address |
| push_content | String | Pushed message content |
| http_code | String | http response code |
| push_time | String | Message push time |
| response_time | String | http response time |
Request example:
curl https://sg.sobot.io/chat-set/api/webhook/response_list
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"http_code": 302,
"sender": "111111",
"product_type": "WhatsApp"
}'
2
3
4
5
6
7
8
9
Return example:
{
"items": [
{
"configid": "3d448933e2e34e32a150aaeba73bc466",
"http_code": 302,
"product_type": "WhatsApp",
"push_content": "{\"entry\":[{\"changes\":[{\"field\":\"account_update\",\"value\":{\"phone_number\":\"111\",\"event\":\"VERIFIED_ACCOUNT\"}}],\"id\":\"111111\",\"time\":1690179982}],\"type\":\"account_update\",\"object\":\"whatsapp_business_account\"}",
"push_time": 1729759869957,
"response_time": 1729759869989,
"sender": "111111111",
"webhook_url": "https://www.baidu.com"
}
],
"page_count": 1,
"page_no": 1,
"page_size": 15,
"ret_code": "000000",
"ret_msg": "success",
"total_count": 5
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# webhook callback exception re-push
API description: webhook callback exception re-push
Request method:
POST
Request URL:
https://sg.sobot.io/chat-set/api/webhook/again_push_response
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| product_type | String | No | Product type (WhatsApp, Facebook, Line) |
| sender | String | No | Sender |
| http_code | int | No | http response code |
| webhook_url | String | No | webhook url |
| push_start_time | Long | No | Push start time [default query for the last 7 days] |
| push_end_time | Long | No | Push end time [default query for the last 7 days] |
| response_start_time | Long | No | Response start time [default query for the last 7 days] |
| response_end_time | Long | No | Response end time [default query for the last 7 days] |
| page_no | Integer | No | Start page (default 1) |
| page_size | Integer | No | Pieces queried (default 15, max 500) |
Return param:
| Param | Type | Description |
|---|---|---|
| ret_code | String | Return code |
| ret_msg | String | Return message |
| items | List | Return object |
| page_count | Integer | Total pages |
| page_no | Integer | Start page |
| page_size | Integer | Pieces |
| total_count | Integer | Total pieces |
| success_count | Integer | Number of successful pushes |
| error_count | Integer | Number of failed pushes |
items object:
| Param | Type | Description |
|---|---|---|
| configid | String | Data Id |
| product_type | String | Product type |
| sender | String | Sender |
| webhook_url | String | Webhook address |
| push_content | String | Pushed message content |
| http_code | String | http response code |
| push_time | String | Message push time |
| response_time | String | http response time |
Request example:
curl https://sg.sobot.io/chat-set/api/webhook/again_push_response
-X POST
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
-d '{
"http_code": 302,
"sender": "1111111",
"product_type": "WhatsApp"
}'
2
3
4
5
6
7
8
9
Return example:
{
"total_count": 5,
"success_count": 2,
"error_count": 3,
"page_no": 1,
"page_size": 15,
"ret_msg": "success",
"ret_code": "000000",
"items": [
{
"configid": "c5c2c7a4ef4044f997fc3c746864b8a8",
"http_code": 302,
"product_type": "WhatsApp",
"push_content": "{\"entry\":[{\"changes\":[{\"field\":\"account_update\",\"value\":{\"phone_number\":\"1111\",\"event\":\"VERIFIED_ACCOUNT\"}}],\"id\":\"1111\",\"time\":1690179982}],\"type\":\"account_update\",\"object\":\"whatsapp_business_account\"}",
"push_time": 1729759090657,
"response_time": 1729759090689,
"sender": "1111",
"webhook_url": "https://www.baidu.com"
},
{
"configid": "960aab0efe7e4272aa4036c02a5eeed8",
"http_code": 302,
"product_type": "WhatsApp",
"push_content": "{\"entry\":[{\"changes\":[{\"field\":\"account_update\",\"value\":{\"phone_number\":\"1111\",\"event\":\"VERIFIED_ACCOUNT\"}}],\"id\":\"111\",\"time\":1690179982}],\"type\":\"account_update\",\"object\":\"whatsapp_business_account\"}",
"push_time": 1729752894690,
"response_time": 1729752894723,
"sender": "11111",
"webhook_url": "https://www.baidu.com"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Bill
# ● Get bill details
Request method:
GET
Request URL:
https://sg.sobot.io/chat-whatsapp/api/whatsapp/billDetailList
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| month | String | Yes | Query month (yyyy-MM) |
| query_type | String | Yes | Query chat type (user: indicate the user, business: indicate the enterprise) |
| sender | String | No | Sender phone no. |
| language | String | No | Language type (zh: Chinese, en: English) |
Request example:
curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/billDetailList?month=2022-10&query_type=user
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802'
2
Return example:
{
"items": [
{
"area_code": "971",
"total_price": 0.1440,
"country_code": "AE",
"country_name": "United Arab Emirates",
"conversation": 6
},
{
"area_code": "880",
"total_price": 0.0274,
"country_code": "BD",
"country_name": "Bangladesh",
"conversation": 1
}
],
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| items | Object | No | Return object |
items object:
| Param | Type | Description |
|---|---|---|
| area_code | String | Region code |
| total_price | double | Billing amount (USD) |
| country_code | String | ISO code |
| country_name | String | Region name |
| conversation | int | No. of chats |
# ● Tech Provider Partner Onboarding
# 1.Tech Provider Solution App Creation
As a Tech Provider partner, your company needs to apply to become a Meta technology service provider. The Meta reference document is as follows:
https://developers.facebook.com/documentation/business-messaging/whatsapp/solution-providers/get-started-for-tech-providers
After becoming a technology service provider, you need to log in to your own application management backend to operate.
https://developers.facebook.com/apps
Under the Products option, find WhatsApp > Partner Solutions, and click Create a partner solution.
Enter the solution name and the App ID provided by Sobot, and set the "Send messages and make calls" option to "Only my partner".
Click "Send request," and Meta will send the application to Sobot. Once Sobot's side approves the application, the Solution App creation will be complete.
# 2.Tech Provider Solution App Linked to Sobot
After successfully creating the Partner Solution App in the first step, Tech Provider needs to open a tenant in Sobot.
TP needs to provide the Solution ID and Company ID corresponding to the Solution App to Sobot, then the process of binding the Partner Solution App will complete to Sobot.
# 3.Tech Provider business customer onboarding
After a business customer completes Meta embedded authorization through the Tech Provider, the Tech Provider needs to actively call the "Tech Provider business customer onboarding Interface" of Sobot.
This interface allows business customers to initiate WABA binding and number registration functions using their authorized Meta BusinessID, Meta WABA ID, and Meta Phone Number ID.
Request method:
POST
Request URL:
https://sg.sobot.com/chat-whatsapp/api/whatsapp/tp/customer/onboarding
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| solution_id | String | Yes | Tech Provider Partner Solution App ID |
| waba_id | String | Yes | Business Customer's Meta WABA ID |
| business_id | String | Yes | Business Customer's WhatsApp Busines Manage ID |
| phone_number_id | String | Yes | Business Customer's WhatsApp Phone Number ID |
| webhook_url | String | Yes | WhatsApp Webhook Notification URL |
| webhook_fields | List | Yes | WhatsApp Webhook Notification Configs |
webhook_fields param:
| Param | Type | Description |
|---|---|---|
| whatsapp_cus_msg_flag | String | Customer Message |
| whatsapp_msg_send_status_flag | String | Enterprise Message Status |
| whatsapp_template_status_flag | String | WhatsApp Template Status |
| whatsapp_account_status_flag | String | WhatsApp Number Status |
| whatsapp_flow_msg_flag | String | Customers Submit Flow Information |
Request example:
curl http://sg.sobot.com/chat-whatsapp/api/whatsapp/tp/customer/onboarding
-X POST
-H 'token: 59605214b9dc4cb8b3318f2dcd7f3d38'
-H 'Content-Type: application/json'
-d '{
"solution_id":"4190740367856672",
"waba_id":"1420518519852735",
"business_id":"865768734787242",
"phone_number_id":"1048063865056888",
"webhook_url":"http://www.baidu.com",
"webhook_fields":[
"whatsapp_cus_msg_flag",
"whatsapp_msg_send_status_flag",
"whatsapp_template_status_flag",
"whatsapp_account_status_flag",
"whatsapp_flow_msg_flag"
]
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| items | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| onboarding_id | String | Tech Provider Business Customer number Onboarding ID |
| status | String | Onboarding Status: Processed-Successd Processing Failed |
Return example:
{
"item": {
"onboarding_id": "b0eef6bce0b94221af082360dbe132e3",
"status": "Processed"
},
"ret_code": "000000",
"ret_msg": "Success"
}
2
3
4
5
6
7
8
# 4.Tech Provider business customer number onboarding result query
API description: Tech Provider business customer onboarding result queryTech Provider business customer onboarding result query
Request method:
GET
Request URL:
http://sg.sobot.com/chat-whatsapp/api/whatsapp/tp/customer/onboarding/{onboarding_id}
Request param:
| Param | Type | Required | Description |
|---|---|---|---|
| onboarding_id | String | Yes | Tech Provider Business Customer number Onboarding ID |
Return param:
| Param | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return code |
| ret_msg | String | Yes | Return message |
| items | Object | No | Return object |
item object:
| Param | Type | Description |
|---|---|---|
| onboarding_id | String | Tech Provider Business Customer number Onboarding ID |
| status | String | Onboarding Status: Processed-Successd Processing Failed |
| error_message | String | Error Reason: When the onboarding process fails, this field returns: Invalid Phone Number ID, System Error. |
Return example:
{
"item": {
"onboarding_id": "b0eef6bce0b94221af082360dbe132e3",
"status": "Processed",
"error_message": null
},
"ret_code": "000000",
"ret_msg": "Success"
}
2
3
4
5
6
7
8
9
# Enum value
# ● template_category
| Param | Description |
|---|---|
| MARKETING | Marketing |
| UTILITY | Transaction related |
| AUTHENTICATION | Authentication |
| MARKETING_LITE | Marketing MMLite |
# ● template_language
| Param | Description |
|---|---|
| de | German |
| hi | Hindi |
| lo | Lao |
| fil | Pilipino |
| lt | Lithuanian |
| hr | Croatian |
| lv | Latvian |
| pt_BR | Portuguese (Brazil) |
| hu | Hungarian |
| uk | Ukrainian |
| es_MX | Spanish (Mexico) |
| id | Indonesian |
| es_ES | Spanish (Spain) |
| ur | Urdu |
| mk | Macedonian |
| ml | Malayalam |
| af | Afrikaans |
| mr | Marathi |
| uz | Uzbek |
| ms | Malay |
| es_AR | Spanish (Argentina) |
| el | Greek |
| en | English |
| it | Italian |
| es | Spanish |
| et | Estonian |
| ar | Arabic |
| vi | Vietnamese |
| nb | Norwegian |
| en_US | English (USA) |
| ja | Japanese |
| az | Azerbaijani |
| fa | Persian |
| zu | Zulu |
| ro | Romanian |
| nl | Dutch |
| fi | Finnish |
| ru | Russian |
| bg | Bulgarian |
| bn | Bengali |
| fr | French |
| zh_HK | China (Hong Kong) |
| zh_TW | China (Taiwan) |
| sk | Slovak |
| sl | Slovene |
| ga | Irish |
| sq | Albanian |
| ca | Catalan |
| sr | Serbian |
| kk | Kazakh |
| kn | Kannada |
| sv | Swedish |
| ko | Korean |
| sw | Swahili |
| ta | Tamil |
| gu | Gujarati |
| cs | Czech |
| pa | Punjabi |
| te | Telugu |
| en_GB | English (UK) |
| th | Thai |
| ha | Hausa |
| zh_CN | Mainland China |
| pl | Polish |
| da | Danish |
| he | Hebrew |
| tr | Turkish |
| pt_PT | Portuguese (Portugal) |
# ● message_status
| Param | Description |
|---|---|
| 0 | Sent |
| 1 | Delivered |
| 2 | Read |
| 9 | Sending failed |
# ● error_code
| Param | Description |
|---|---|
| 1 | Request invalid or server error |
| 2 | Service exception |
| 4 | Too many API calls |
| 33 | Invalid parameters |
| 100 | Invalid parameters |
| 131000 | Unknown error |
| 131005 | Insufficient WhatsApp permissions |
| 131008 | Required parameters missing |
| 131009 | Invalid param value |
| 131016 | Service unavailable |
| 131021 | Recipient cannot be the sender |
| 131026 | Recipient number not found/user has not accepted the privacy policy/user's WhatsApp version is too low |
| 131042 | Business account payment account issue |
| 131045 | Phone number registration error |
| 131047 | Chat exceeds 24-hour window |
| 131051 | Message type not supported |
| 131052 | Media download error |
| 131053 | Media upload error |
| 132000 | Inconsistent param passing variables and template variables |
| 132001 | Template not found |
| 132002 | Template text filling is too long |
| 132007 | Violation of template format char policy |
| 132012 | Inconsistent template param format |
| 132015 | Invalid template param |
| 133000 | Logout not completed |
| 133004 | Server unavailable |
| 135000 | General user error |
| 132005 | Template text filling is too long |
| 131056 | Excessive number of times sent by the same user |
| 130429 | Reached the sending limit |
| 131048 | Reached the sending limit of junk messages |
| 80007 | Issue with sending limit |
| 368 | Temporarily disabled for policy violation |
| 131031 | Account locked |
| 130472 | User number involved in experiment |
| 133010 | Phone number not registered |
| 000000 | -- |
| 999996 | WhatsApp number not found |
| 999997 | Insufficient WhatsApp package balance |
| 999998 | Unknown error - network timeout |
| 999999 | WhatsApp number is blank |
| 110337 | Template does not exist |
| 110402 | The sender number does not exist |
| 110406 | The request body is empty |
| 110407 | The current message type is not supported |
| 110408 | The sender number ID is empty |
| 110409 | The number to receive the message is empty |
| 110410 | The content to be sent is empty |
| 110412 | The uploaded file cannot be empty |
| 110413 | The request time only accepts millisecond-level timestamp format. |
| 110414 | Incorrect value for message_direction |
| 110415 | The context is invalid. Please start the request again from the first page |
# ● WhatsApp_Flows_API_ErrorCode
| Param | Description |
|---|---|
| 100 | Flow name is not unique Invalid Flow JSON version Invalid Flow JSON data_api_version Flow with specified ID does not exist Only one clone source can be set Specify Endpoint Uri in Flow JSON Invalid Endpoint URI |
| 139000 | Blocked By Integrity |
| 139001 | Flow can't be updated Error while processing Flow JSON Specify Endpoint Uri in Flow JSON |
| 139002 | Publishing Flow in invalid state Publishing Flow with validation errors Publishing Flow without data_channel_uri Publishing without specifying endpoint_uri is forbidden Versions in Flow JSON file are not available for publishing No Phone Number connected to WhatsApp Business Account Missing Flows Signed Public Key No Application Connected to the Flow Endpoint Not Available WhatsApp Business Account is not subscribed to Flows Webhooks |
| 139003 | Can't deprecate unpublished flow Flow is already deprecated |
| 139004 | Can't delete published Flow |
| 139006 | Metrics threshold is not reached |
# ● region
| Param | Description |
|---|---|
| AR | Argentina |
| BR | Brazil |
| CL | Chile |
| CO | Colombia |
| EG | Egypt |
| FR | France |
| DE | Germany |
| IN | India |
| ID | Indonesia |
| IL | Israel |
| IT | Italy |
| MY | Malaysia |
| MX | Mexico |
| NL | Netherlands |
| NG | Nigeria |
| PK | Pakistan |
| PE | Peru |
| RU | Russian Federation |
| SA | Saudi Arabia |
| ZA | South Africa |
| ES | Spain |
| TR | Turkey |
| AE | United Arab Emirates |
| GB | United Kingdom |
| CA | Canada |
| US | United States |
| DZ | Algeria |
| AO | Angola |
| BJ | Benin |
| BW | Botswana |
| BF | Burkina Faso |
| BI | Burundi |
| CM | Cameroon |
| TD | Chad |
| CD | Congo |
| ER | Eritrea |
| ET | Ethiopia |
| GA | Gabon |
| GM | Gambia |
| GH | Ghana |
| GN | Guinea |
| GW | Guinea-Bissau |
| CI | Ivory Coast |
| KE | Kenya |
| LS | Lesotho |
| LR | Liberia |
| LY | Libya |
| MG | Madagascar |
| MW | Malawi |
| ML | Mali |
| MR | Mauritania |
| MA | Morocco |
| MZ | Mozambique |
| NA | Namibia |
| NE | Niger |
| RW | Rwanda |
| SN | Senegal |
| SL | Sierra Leone |
| SO | Somalia |
| SS | South Sudan |
| SD | Sudan |
| SZ | Eswatini |
| TZ | Tanzania |
| TG | Togo |
| TN | Tunisia |
| UG | Uganda |
| ZM | Zambia |
| AF | Afghanistan |
| AU | Australia |
| BD | Bangladesh |
| KH | Cambodia |
| CN | China |
| HK | Hong Kong |
| JP | Japan |
| LA | Laos |
| MN | Mongolia |
| NP | Nepal |
| NZ | New Zealand |
| PG | Papua New Guinea |
| PH | Philippines |
| SG | Singapore |
| LK | Sri Lanka |
| TW | Taiwan |
| TJ | Tajikistan |
| TH | Thailand |
| TM | Turkmenistan |
| UZ | Uzbekistan |
| VN | Vietnam |
| AL | Albania |
| AM | Armenia |
| AZ | Azerbaijan |
| BY | Belarus |
| BG | Bulgaria |
| HR | Croatia |
| CS | Czech Republic |
| GE | Georgia |
| GR | Greece |
| HU | Hungary |
| LV | Latvia |
| LT | Lithuania |
| MK | Macedonia |
| MD | Moldova |
| PL | Poland |
| RO | Romania |
| RS | Serbia |
| SK | Slovakia |
| SI | Slovenia |
| UA | Ukraine |
| BO | Bolivia |
| CR | Costa Rica |
| DO | Dominican Republic |
| EC | Ecuador |
| SV | El Salvador |
| GT | Guatemala |
| HT | Haiti |
| HN | Honduras |
| JM | Jamaica |
| NI | Nicaragua |
| PA | Panama |
| PY | Paraguay |
| PR | Puerto Rico |
| UY | Uruguay |
| VE | Venezuela |
| BH | Bahrain |
| IQ | Iraq |
| JO | Jordan |
| KW | Kuwait |
| LB | Lebanon |
| OM | Oman |
| QA | Qatar |
| YE | Yemen |
| AT | Austria |
| BE | Belgium |
| DK | Denmark |
| FI | Finland |
| IE | Ireland |
| NO | Norway |
| PT | Portugal |
| SE | Sweden |
| CH | Switzerland |
| ZW | Zimbabwe |
| OTHER | Others |
# ● send_source
| Param | Description |
|---|---|
| 1 | Broadcast |
| 2 | API |
| 3 | Agent Workbench |
| 4 | CRM |
| 5 | Rule Engine |
| 6 | Call Center |
# ● message_category
| Param | Description |
|---|---|
| authentication | authentication |
| authentication_international | authentication-international |
| utility | utility |
| marketing | marketing |
| marketing_lite | marketing_lite |
| referral_conversion | referral-conversion |
| service | service |
# ● template_language
| Language | Code |
|---|---|
| Afrikaans | af |
| Albanian | sq |
| Arabic | ar |
| Arabic (Egypt) | ar_EG |
| Arabic (UAE) | ar_AE |
| Arabic (Lebanon) | ar_LB |
| Arabic (Morocco) | ar_MA |
| Arabic (Qatar) | ar_QA |
| Azerbaijani | az |
| Belarusian | be_BY |
| Bengali | bn |
| Bengali (India) | bn_IN |
| Bulgarian | bg |
| Catalan | ca |
| Chinese (Simplified, China) | zh_CN |
| Chinese (Traditional, Hong Kong) | zh_HK |
| Chinese (Traditional, Taiwan) | zh_TW |
| Croatian | hr |
| Czech | cs |
| Danish | da |
| Dari | prs_AF |
| Dutch | nl |
| Dutch (Belgium) | nl_BE |
| English | en |
| English (UK) | en_GB |
| English (US) | en_US |
| English (UAE) | en_AE |
| English (Australia) | en_AU |
| English (Canada) | en_CA |
| English (Ghana) | en_GH |
| English (Ireland) | en_IE |
| English (India) | en_IN |
| English (Jamaica) | en_JM |
| English (Malaysia) | en_MY |
| English (New Zealand) | en_NZ |
| English (Qatar) | en_QA |
| English (Singapore) | en_SG |
| English (Uganda) | en_UG |
| English (South Africa) | en_ZA |
| Estonian | et |
| Filipino | fil |
| Finnish | fi |
| French | fr |
| French (Belgium) | fr_BE |
| French (Canada) | fr_CA |
| French (Switzerland) | fr_CH |
| French (Côte d'Ivoire) | fr_CI |
| French (Morocco) | fr_MA |
| Georgian | ka |
| German | de |
| German (Austria) | de_AT |
| German (Switzerland) | de_CH |
| Greek | el |
| Gujarati | gu |
| Hausa | ha |
| Hebrew | he |
| Hindi | hi |
| Hungarian | hu |
| Indonesian | id |
| Irish | ga |
| Italian | it |
| Japanese | ja |
| Kannada | kn |
| Kazakh | kk |
| Kinyarwanda | rw_RW |
| Korean | ko |
| Kyrgyz (Kyrgyzstan) | ky_KG |
| Lao | lo |
| Latvian | lv |
| Lithuanian | lt |
| Macedonian | mk |
| Malay | ms |
| Malayalam | ml |
| Marathi | mr |
| Norwegian | nb |
| Pashto | ps_AF |
| Persian | fa |
| Polish | pl |
| Portuguese (Brazil) | pt_BR |
| Portuguese (Portugal) | pt_PT |
| Punjabi | pa |
| Romanian | ro |
| Russian | ru |
| Serbian | sr |
| Sinhala | si_LK |
| Slovak | sk |
| Slovenian | sl |
| Spanish | es |
| Spanish (Argentina) | es_AR |
| Spanish (Chile) | es_CL |
| Spanish (Colombia) | es_CO |
| Spanish (Costa Rica) | es_CR |
| Spanish (Dominican Republic) | es_DO |
| Spanish (Ecuador) | es_EC |
| Spanish (Honduras) | es_HN |
| Spanish (Mexico) | es_MX |
| Spanish (Panama) | es_PA |
| Spanish (Peru) | es_PE |
| Spanish (Spain) | es_ES |
| Spanish (Uruguay) | es_UY |
| Swahili | sw |
| Swedish | sv |
| Tamil | ta |
| Telugu | te |
| Thai | th |
| Turkish | tr |
| Ukrainian | uk |
| Urdu | ur |
| Uzbek | uz |
| Vietnamese | vi |
| Zulu | zu |