WhatsApp Broadcast

Component Explanation :

You don't need to use whatsappRecipient field if you already use recipient field. This also applies in a reverse way.

Create Recipients

Body Create Recipients

To create recipients, you must upload your recipient number with format xlsx. You must fill the recipients data and save it with format xlsx, like image below.

You can choose form-data format on Body and fill the key with 'uploadFile', change the type with file then you can click select files button to select recipient document on your device. Click Send button to upload file.

You can choose form-data format on Body and fill the key with 'uploadFile', change the type with file then you can click select files button to select recipient document on your device. Click Send button to upload file.

Response

Response status: 200

Response status: 200

{
  "recipient_id": "[recipient id]" *generated automatically by system
}

Verify Phone Number

Response:

Response status: 200

Response status: 200

{
  "status": "success",
  "data": [
    {
      "input": "phone-number-1",
      "status": "valid"
    },
    {
      "input": "phone-number-2",
      "status": "invalid"
    }
  ],
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Send Broadcast Text

Body:

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    "content" : [
        
    ]
}

Response: 200

Response:

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Example Send Broadcast Text

Below is a representation when using the WhatsApp broadcast API for sending a broadcast text on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Image

Example Send Broadcast Text

Body:

Below is a representation when using the WhatsApp broadcast API for sending a broadcast text on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Image

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    "content" : [
       {     
            "type": "image",
            "url": "your-url-for-image", | url https, format jpg/png
        }
    ]
}

Response: 200

Response:

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Example Send Broadcast Image

Below is a representation when using the WhatsApp broadcast API for sending a broadcast image on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template (when using images notification template, you must fill in the 'type' field with 'image' and your image url with https format and image extension type). The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Video

Example Send Broadcast Image

Body:

Below is a representation when using the WhatsApp broadcast API for sending a broadcast image on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template (when using images notification template, you must fill in the 'type' field with 'image' and your image url with https format and image extension type). The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Video

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    "content" : [
        {
            "type": "video",
            "url": "your-url-for-video", | url https, format mp4
            "thumbnailUrl" : "your-url-for-thumbnail"
        }
    ]
}

Response: 200

Response:

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Example Send Broadcast Video

Below is a representation when using the WhatsApp broadcast API for sending a broadcast video on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application, as well as the templateId field like selecting the notification template (when using video notification template, you must fill in the 'type' field with 'video' and your video url with https format and video extension type). The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Document

Example Send Broadcast Video

Body:

Below is a representation when using the WhatsApp broadcast API for sending a broadcast video on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template (when using video notification template, you must fill in the 'type' field with 'video' and your video url with https format and video extension type). The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Document

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    "content" : [
        {
            "type": "document",
            "url": "your-url-for-document", | url https, format pdf
        }
    ]
}

Response:

Response status: 200

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Example Send Broadcast Document

Below is a representation when using the WhatsApp broadcast API for sending a broadcast document on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template (when using document notification template, you must fill in the 'type' field with 'document' and your document url with https format and document extension type). The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Quick Reply

Example Send Broadcast Document

Body:

Below is a representation when using the WhatsApp broadcast API for sending a broadcast document on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application snd the templateId field like selecting the notification template (when using document notification template, you must fill in the 'type' field with 'document' and your document url with https format and document extension type). The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Quick Reply

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    "content" : [ 
    
    ]
}

Response:

Response status: 200

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Example Send Broadcast Quick Reply

Below is a representation when using the WhatsApp broadcast API for sending a broadcast quick reply on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Macro in Body

Example Send Broadcast Quick Reply

Body:

Below is a representation when using the WhatsApp broadcast API for sending a broadcast quick reply on the 3Dolphins application.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Macro in Body

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    "bodyVariables" : [ 
        {
            "type": "personalized", 
            "key": "{{1}}", 
            "value": "Nama"
        },  
        {
            "type": "personalized", 
            "key": "{{2}}", 
            "value": "Title"
        }
    ],
    "content" : [ 
    
    ]
}

Response:

Response status: 200

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Example of macro variable:

Example of recipient file (must be .xlsx format) :

In example above, field that being defined is Nama and Title. We can use this field on our Header Variables/Body Variables.

Example Send Broadcast Macro in Body

Below is a representation when using the WhatsApp broadcast API for sending a broadcast macro in the notification body.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. The template variables field for the body will appear when you use a broadcast macro to fill in the values for the key, type, and value fields. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Broadcast Macro in Header and Body

Example Send Broadcast Macro in Body

Below is a representation when using the WhatsApp broadcast API for sending a broadcast macro in the notification body.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application, as well as the templateId field like selecting the notification template. The name field will also be the title for your notification. The template variables field for the body will appear when you use a broadcast macro to fill in the values for the key, type, and value fields. SendingMode field is like specify the sending option to be used (if you use 'schedule', you can choose the time when the notification will be sent).

Send Broadcast Macro in Header and Body

Component Explanation:

Example of macro variable:

Example of recipient file (must be .xlsx format) :

In example above, field that being defined is Nama and Title. We can use this field on our Header Variables/Body Variables.

Body:

Body:

{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334",
    "templateId" : "wa-template-id", 
    "recipient": "recipient-id",  
    
    "headerVariables" : [ 
        {"key": "{{1}}", "value": "Nama"}
     ],
    "bodyVariables" : [
        {"key": "{{1}}", "value": "Nama"},  
        {"key": "{{2}}", "value": "Tanggal"}
     ],
    "content" : [ 
    
    ]
}

Response:

Response status: 200

Response status: 200

{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

The example of headerVariables above has a meaning, you mapping value of field Name into macro {1} The example of bodyVariables above has a meaning, you mapping value of field Name into macro {1} and value of field Tanggal into macro {2}.

When broadcast being send into the recipient macro {1} and {2} would be replaced with the value from recipient file. In this example, the macro would be replaced with M.Ridwan and 22-04-2021. So the end result would be like this:

When broadcast being send into the recipient macro {1} and {2} would replaced with the value from recipient file. On this example, the macro would replaced with M.Ridwan and 22-04-2021. So the end result would be like this:

Halo, M.Ridwan

Terima kasih sudah mendaftarkan diri anda. Berikut lampiran datanya Nama: M. Ridwan Tanggal keberangkatan: 22-04-2021

Example Send Broadcast Macro in Header and Body

Below is a representation when using the WhatsApp broadcast API for sending a broadcast macro in the notification header and body.

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. The template variables field for header and body will appear when you use a broadcast macro to fill in the values for the key, type, and value fields. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Multiple Broadcast

Example Send Broadcast Macro in Header and Body

Below is a representation when using the WhatsApp broadcast API for sending a broadcast macro in the notification header and body.

Body for Multiple Broadcast:

When you enter the channel field using the channel id in the API, it will be like selecting an account on the application and the templateId field like selecting the notification template. The name field will also be the title for your notification. The template variables field for header and body will appear when you use a broadcast macro to fill in the values for the key, type, and value fields. SendingMode field is like specifying the sending option to be used (if you use 'schedule', you can choose when the notification will be sent).

Send Multiple Broadcast

Multiple broadcast allows you to create more than one broadcast at once.

Body for Multiple Broadcast:

[ 
*code for first broadcast request
{ 
   "name":"your-broadcast-name", 
   "channel":"channel-used-for-broadcast", 
   "sendingMode":"sending-mode",
   "scheduledDate":"2021-01-01 23:30:334",
   "content" : [ 
     { 
        "type" : "text", 
        "message": "First broadcast" 
      } 
   ] 
},
*code for second broadcast request
{ 
   "name":"your-broadcast-name", 
   "channel":"channel-used-for-broadcast", 
   "sendingMode":"sending-mode",
   "scheduledDate":"2021-01-01 23:30:334",
   "content" : [ 
     { 
        "type" : "text", 
        "message": "Second broadcast" 
      } 
   ] 
}
]

Response:

Response status: 200

Response status: 200

{
  "status": "success",
  "data": [
    {
      "id": "[id]",
      "message": "Successfully make Broadcast Item",
      "status": "success"
    },
     {
      "id": "[id]",
      "message": "Successfully make Broadcast Item",
      "status": "success"
    }
  ],
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}

Get Broadcast Detail by ID

Response:

Response status: 200

Response status: 200

{
    "status": "success",
    "data": {
        "id": "your-broadcast-id",
        "spell": [
            "New Notification",
            "{\"header\":[],\"body\":[{\"type\":\"static\",\"key\":\"{{1}}\",\"value\":\"{value}\"},{\"type\":\"static\",\"key\":\"{{2}}\",\"value\":\"{value}\"}]}"
        ],
        "owner": "owner-id",
        "createdDate": 1614657234000,
        "createdBy": "created-by-id",
        "modifiedDate": 1614657340548,
        "modifiedBy": "system",
        "templateId": "template-id",
        "actionDate": 1614657339000,
        "name": "New Notification",
        "message": "{\"header\":[],\"body\":[{\"type\":\"static\",\"key\":\"{{1}}\",\"value\":\"{value}\"},{\"type\":\"static\",\"key\":\"{{2}}\",\"value\":\"{value}\"}]}",
        "recipient": [
            "{\"type\":\"contact\",\"id\":\"{recipient-id}\",\"phone\":\"{phone-number}\",\"selected\":true}"
        ],
        "status": "Sent",
        "channel": "your-channel-id",
        "channelType": "your-channel-type",
        "sendingMode": "Now",
        "scheduledDate": 1614657339000,
        "scheduledTime": "10:55"
    },
    "hasMore": false,
    "nextIndex": 0,
    "prevIndex": 0,
    "totalResults": 0
}

Create Broadcast WhatsApp

Broadcast template id must be created first in order to use WhatsApp broadcast API.

Body:

{
  "name": "string",
  "recipient": "string",
  "status": "string",
  "channel": "string",
  "sendingMode": "string",
  "templateId": "string",
  "scheduledDate": "string",
  "botId": "string",
  "dialogId": "string",
  "content": [
    {
      "type": "string",
      "url": "string",
      "message": "string",
      "thumbnailUrl": "string"
    }
  ],
  "headerVariables": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "bodyVariables": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "whatsappRecipient": [
    {
      "Recipient": "string"
    }
  ]
}

Response:

Response Status: 200

{
    "name": "your-broadcast-name",
    "channel": "channel-used-for-broadcast",
    "sendingMode": "Now",
    "templateId": "wa-template-id",
    
    "bodyVariables": [
        {
            "type": "personalized",
            "key": "{{1}}",
            "value": "Nama"
        },
        {
            "type": "personalized",
            "key": "{{2}}",
            "value": "Title"
        }
    ],
    "content": [
        
    ],
    "whatsappRecipient": [
        {
            "Recipient": 6282xxxxxxxxx,
            "Nama": "ardian",
            "Title": "kak"
        },
        {
            "Recipient": 6282xxxxxxxxx,
            "Nama": "doni aprr",
            "Title": "kak"
        }
    ]
}

Last updated