Get started

    API Endpoint

        https://betterchat.in/api/v2/                

You can use the this API to send text messages, media/documents, and template messages to your customers.

To use this API, you need an API key. You can find your API key in WhatsApp number page

Conversations are message threads between you and your customers. Conversations can last up to 24-hours and must be initiated by you (business-initiated) or your customers (user-initiated). Customers can initiate a conversation by sending you any type of message, but you can only initiate a conversation with a template message. Once the conversation has begun, you can then send any type of message to the customer.

Send Template


# Here is a curl example
curl \
 POST https://betterchat.in/api/v2/template/{your_api_key} \
-H 'Content-Type: application/json' \
-d '{ 
      "to_num":"recipient number",  
      "to_name":"recipient name", 
      "template":"hellow_world", 
      "media_url":"", 
      "varibale":["variable1", "variable2"], 
      "button_url":[]
    }' 
                

To send template message you need to make a POST call to the following url :
https://betterchat.in/api/v2/template/{your_api_key}



Result example :

{
   "success" : true,
   "id" : "ea3434....",
   "message" : "message..",
   "timestamp" : "1504902988"
}
                

Properties

Field Type Description
to_num Integer Recipient Phone Number with country code
to_name String (optional) Recipient Name
template String Template Name
media_url String (optional) header media url if selected in templete. must be a valid url and publicly accessible.
variable Array (optional) body variable value in array object:
Like:
["first value", "Second value", "..."]
button_url Array (optional) website button dynamic url sub path if selected in templete.
Like:
["?ref=122", "/order/id=122"]

Send Message


# Here is a curl example
curl \
-X POST https://betterchat.in/api/v2/message/{your_api_key} \
-H 'Content-Type: application/json' \
-d '{ 
      "to_num":"recipient number",  
      "to_name":"recipient name", 
      "message":"hello..",  
    }'
                

To send message you need to make a POST call to the following url :
https://betterchat.in/api/v2/message/{your_api_key}



Result example :

{
   "success" : true,
   "id" : "ea3434....",
   "message" : "message..",
   "timestamp" : "1504902988"
}
                

            
# Here is a curl example with interactive message as button
curl \
-X POST https://betterchat.in/api/v2/message/{your_api_key} \
-H 'Content-Type: application/json' \
-d '{
    "to_num": "recipient number",
    "to_name": "recipient name",
    "message": "hello..",
    "interactive": {
        "type": "button",
        "name": "Click me",
        "data": [
            {
                "id": "101",
                "title": "button or list menu name" 
            },
            {
                "id": "102",
                "title": "button or list menu name" 
            }
        ]
    }
}'
 
  
   
# Here is a curl example with interactive message as list
curl \
-X POST https://betterchat.in/api/v2/message/{your_api_key} \
-H 'Content-Type: application/json' \
-d '{
    "to_num": "recipient number",
    "to_name": "recipient name",
    "message": "hello..",
    "interactive": {
        "type": "list",
        "name": "menu list name (default menu)",
        "data": [
            {
                "id": "103",
                "title": "Option 1",
                "description": "any description if type is list"
            },
            {
                "id": "104,
                "title": "Option 2",
                "description": "any description if type is list"
            }
        ]
    }
}'
 
 

Properties

Field Type Description
to_num Integer Recipient Phone Number with country code
to_name String (optional) Recipient Name
message String Message content
interactive Object (optional) send list or button in message:
Send upto 3 buttons or 9 list option

You can only initiate a conversation with a template message. Once the conversation has begun, you can then send any type of message to the customer. Customers can also initiate a conversation by sending you any type of message

Send Attachment


# Here is a curl example
curl \
-X POST https://betterchat.in/api/v2/attachment/{your_api_key} \
-H 'Content-Type: application/json' \
-d '{ 
      "to_num":"recipient number",  
      "to_name":"recipient name", 
      "media_url":"media link", 
      "caption":"any caption..." 
    }'
    
                

To send attachment you need to make a POST call to the following url :
https://betterchat.in/api/v2/attachment/{your_api_key}



Result example :

{
   "success" : true,
   "id" : "ea3434....",
   "message" : "message..",
   "timestamp" : "1504902988"
}
                

QUERY PARAMETERS

Field Type Description
to_num Integer Recipient Phone Number with country code
to_name String (optional) Recipient Name
link String Media link
caption String (optional) Any caption

Errors

The Betterflow API uses the following error codes:

Error Code Meaning
101 Some parameters are missing. This error appears when you don't pass every mandatory parameters.
102 Unknown or unvalid api_key. This error appears if you use an unknow API key or if your API key expired.
103 to_num parameter is missing.
104 Unvalid parameter value. This error appears if you pass invalid value like wrong template name.