Developer Documentation Developer Documentation
Help Center (opens new window)
Help Center (opens new window)
  • WhatsApp

    • WhatsApp API
    • International SMS

    • Messenger

    • LINE API

    • Operations Support

    • Message Product API
    • WhatsApp
    Sobot
    2023-07-20
    Menus

    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
    
    1

    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/
    
    1

    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
    
    1

    Return example:

    {
      "item": {
        "token": "4ac37cb2e9c740dba4b75a34d5358802",
        "expires_in": "86400"
      },
      "ret_code": "000000",
      "ret_msg": "success"
    }
    
    1
    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
    
    1

    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"
    }'
    
    1
    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"
    }'
    
    1
    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"
    }'
    
    1
    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"
    }'
    
    1
    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"
        }'
    
    1
    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"
        }'
    
    1
    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"
    }'
    
    1
    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"
    }
    '
    
    1
    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"
    }
    '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    text String Yes Content

    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"
    	},
    	"from": "FROM_PHONE_NUMBER_ID",
    	"to": "PHONE_NUMBER",
    	"type": "text"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    media_url String Yes Resource link

    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": "image"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    media_url String Yes Resource link
    file_name String No File name

    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"
    	},
    	"from": "FROM_PHONE_NUMBER_ID",
    	"to": "PHONE_NUMBER",
    	"type": "document"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    media_url String Yes Resource link

    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": "video"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    media_url String Yes Resource link

    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"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    media_url String Yes Resource link

    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"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    content param:

    Param Type Required Description
    latitude String Yes Latitude
    longitude String Yes Longitude

    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"
    	},
    	"from": "FROM_PHONE_NUMBER_ID",
    	"to": "PHONE_NUMBER",
    	"type": "location"
        } '
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    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

    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"
        }'
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    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

    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"
    }'
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    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

    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"
    }'
    
    1
    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"
    }
    
    1
    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
    
    1

    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

    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

    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"
    }'
    
    1
    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"
    }
    
    1
    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
    
    1

    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"
    }'
    
    1
    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"
    }
    
    1
    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
    
    1
    # ● Text message

    Return example:

    {
      "content": {
        "text": "this is text"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "text",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # ● Image message

    Return example:

    {
      "content": {
        "mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "image",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # ● File message

    Return example:

    {
      "content": {
        "mediaUrl": "https://img.sobot.com/console/common/face/robot.png",
        "filename": "example.txt"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "document",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # ● Video message

    Return example:

    {
      "content": {
        "mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "video",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # ● Audio message

    Return example:

    {
      "content": {
        "mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "audio",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # ● Sticker message

    Return example:

    {
      "content": {
        "mediaUrl": "https://img.sobot.com/console/common/face/robot.png"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "sticker",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # ● Location message

    Return example:

      {
      "content": {
        "latitude": "LAT_NUMBER",
        "longitude": "LONG_NUMBER"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "location",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # ● Contact message

    Return example:

    {
      "content": {
        "contacts": [
          {
            "name": {
              "formatted_name": "NAME",
              "first_name": "NAME"
            },
            "phones": [
              {
                "phone": "PHONE_NUMBER",
                "wa_id": "8618888888888",
                "type": "CELL"
              }
            ]
          }
        ]
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "contacts",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    # ● Button message

    Return example:

    {
      "content": {
        "button": {
          "payload": "No-Button-Payload",
          "text": "No",
          "messageid": "123456789qazwsxedcrfvhbhsfdgsfgsb"
        }
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "button",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # ● 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"
            }
          ]
        }
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "order",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    # ● Interactive message

    Return example:

    {
      "content": {
        "interactive": {
          "type": "button_reply",
          "button_reply": {
            "id": "unique-button-identifier-here",
            "title": "button-text"
          }
        }
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "interactive",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    # ● 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"
        },
        "text": "body"
      },
      "from": "FROM_PHONE_NUMBER_ID",
      "to": "PHONE_NUMBER",
      "type": "text",
      "name": "NAME"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    # ● Flow callback message

    Return example:

    {
      "content": {
    	"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"
    	}
      },
      "from": "8618210323232",
      "name": "TESTNAME",
      "to": "110243462020762",
      "type": "interactive"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    # ● Welcome Message callback message

    Return example:

    {
      "content": {
    	"contacts": [{
          "profile": {
        	  "name": "666"
        	},
          "wa_id": "8618518444333"
        }]
      },
      "from": "8618210323232",
      "name": "TESTNAME",
      "to": "110243462020762",
      "type": "request_welcome"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14

    # Message template management

    # ● Get message template

    API description: Retrieve all templates in the current wabaId

    Request method:

    GET

    Request URL:

     https://sg.sobot.io/chat-whatsapp/api/whatsapp/templateList
    
    1

    Request param:

    Param Type Required Description
    wabaid String Yes The unique ID of WhatsApp business account

    Request example:

    curl https://sg.sobot.io/chat-whatsapp/api/whatsapp/templateList?wabaid=12345
    -H 'token: 4ac37cb2e9c740dba4b75a34d5358802' 
    
    1
    2

    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"
              }
            ],
            "name": "templates_test",
            "language": "zh_CN",
            "id": "601486201712874",
            "category": "TRANSACTIONAL",
            "status": "APPROVED"
          }
        ],
        "namespace": "9eb0ceda_9fc9_42ad_ad5a_5dd9d905a15a"
      },
      "ret_code": "000000",
      "ret_msg": "success"
    }
    
    1
    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

    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
    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
    # ● Create message template

    API description: create message template

    Request method:

    POST

    Request URL:

     https://sg.sobot.io/chat-whatsapp/api/whatsapp/createTemplateInfo
    
    1

    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)

    1. 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"
    				}
    			]
    		}
    	]
    }'
    
    1
    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
    1. 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"
                    }
                ]
            }
        ]
    }'
    
    1
    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
    1. 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"
    }'
    
    1
    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
    1. 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"
    				}
    			]
    		}
    	]
    }'
    
    1
    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"
    				}
    			]
    		}
    	]
    }'
    
    1
    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"
    				}
    			]
    		}
    	]
    }'
    
    1
    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"
    }
    
    1
    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
    
    1

    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' 
    
    1
    2

    Return example:

    {
      "item": {
        "success": true
      },
      "ret_code": "000000",
      "ret_msg": "success"
    }
    
    1
    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

    # Webhook status notification

    Request URL:

       webhook notification message return example, configured in the Sobot Admin Center backend
    
    1
    # ● 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=",
      "status": "sent",
      "timestamp": "1667453467",
      "to": "PHONE_NUMBER",
      "type": "status"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # ● 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"
    }
    
    1
    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"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    # ● 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"
    }
    
    1
    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"
    }
    
    1
    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
    
    1

    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
    
    1

    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"
    }
    
    1
    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
    
    1

    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
    
    1

    Return example:

    {
        "item": {
            "id": "1011461420318338"
        },
        "ret_code": "000000",
        "ret_msg": "success"
    }
    
    1
    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
    
    1

    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"
    }'
    
    1
    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
    }
    
    1
    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
    
    1

    Request param:

    Param Type Required Description
    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 sender
    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
    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
    error_code String Error Code
    timezone String Time Zone
    regionid String Region ID
    messageid String Message ID
    taskid String Task ID
    recipient_tel String Receiver number
    send_agentid String Sender
    template_category String Template category
    message_status String Message status
    template_name String Template name
    send_time Long Sending time
    partnerid String Docking ID
    sender String sender
    templateid String Template ID
    region String Region
    businessid String Business ID
    status_update_time Long Status update time
    subjectid String Marketing theme ID

    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"
    }'
    
    1
    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
    }
    
    1
    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

    # 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
    
    1

    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"
    }'
    
    1
    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
    }
    
    1
    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
    
    1

    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"
    }'
    
    1
    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"
        }
      ]
    }
    
    1
    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
    
    1

    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' 
    
    1
    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"
    }
    
    1
    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

    # Enum value

    # ● template_category
    Param Description
    MARKETING Marketing
    UTILITY Transaction related
    AUTHENTICATION Authentication
    # ● 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
    # ● region
    Param Description
    ARG 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-Bissau
    CIV 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
    R Rwanda
    SN Senegal
    SL Sierra Leone
    SO Somalia
    SD 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
    OTHER Others
    Last Updated: 4/2/2025, 5:28:05 PM

    International SMS→

    Update Date
    01
    Operations Support API
    04-03
    02
    CRM Docking Scheme
    12-05
    03
    AI Agent API
    09-09
    More Articles>
    Theme by Vdoing
    • Follow Sys
    • Line
    • Dark
    • Read