# WhatsApp Broadcast

**Component Explanation :**

<table data-header-hidden><thead><tr><th>Field Name</th><th width="260.66666666666663">Description</th><th>Required</th></tr></thead><tbody><tr><td>Field Name</td><td>Description</td><td>Required</td></tr><tr><td>Authorization</td><td>Generated token id</td><td>Yes</td></tr><tr><td>name</td><td>Name of your broadcast</td><td>Yes</td></tr><tr><td>channel</td><td>Channel id of your used channel</td><td>Yes</td></tr><tr><td>sendingMode</td><td><p>The sending method you will use. <br>Currently there are 2 sending mode, i.e : send immediately (now)  and scheduled send (scheduled)</p><p></p><p>possible value: <em>Now, Scheduled</em></p></td><td>Yes</td></tr><tr><td>scheduledDate</td><td><p>The date and time scheduled for sending broadcast</p><p></p><p>Field format: "yyyy-mm-dd hh:mm:sss"</p></td><td>Yes, when sending mode is 'Scheduled'</td></tr><tr><td>templateId</td><td><p>Id of the template that you want to use for your broadcast</p><p></p><p>wa-template-id must defined first in 3Dolphins UI</p></td><td><p>Yes</p><p></p></td></tr><tr><td>recipient</td><td><p>your recipient id</p><p></p><p>acquired from creating recipient with Recipient endpoint</p></td><td>Yes</td></tr><tr><td>headerVariables</td><td>Variable object of your header</td><td>Yes, only when WhatsApp template being used has macro in Header</td></tr><tr><td>bodyVariables</td><td>Variable object of your body</td><td>Yes, only when WhatsApp template being used has macro in Body</td></tr><tr><td>content</td><td><p>the contents of your broadcast message.</p><p></p><p>Note : For WhatsApp broadcast you can only attach one media on a single broadcast</p></td><td>Yes</td></tr><tr><td>botId</td><td>your bot id when the dialog trigger is used.</td><td>No</td></tr><tr><td>dialogId</td><td>your dialog id that will be used as trigger dialog.</td><td>No</td></tr><tr><td>whatsappRecipient</td><td>your phone number's recipients.</td><td>Yes</td></tr></tbody></table>

{% hint style="info" %}
You don't need to use whatsappRecipient field if you already use recipient field. This also applies in a reverse way.
{% endhint %}

### Create Recipients

| Method     | POST                                                                                                                                                  |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast/upload/recipient&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple) |
| Header     | Authorization : Bearer \[generatedToken]                                                                                                              |

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

![recipient-import-document.xlsx](https://765826444-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNQidQwa-0K9_KnQpoc%2F-MWghnZmORFyMFlBVPJt%2F-MWXjvZ3SX6D-POV3-Px%2Fupload%20recipient%20xlsx.png?alt=media\&token=f407a4d2-4f2d-4eaf-9a36-1c88a4c794e2)

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.

![](https://765826444-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNQidQwa-0K9_KnQpoc%2F-MWTdTlrAlg3AOoJ5cHl%2F-MWXjbTk_QuUiTntv5Sv%2Fupload%20recipient.png?alt=media\&token=f64f035e-3434-4207-bb5a-69110ec179e8)

#### Response

Response status: 200

Response status: 200

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

### Verify Phone Number

| Method     | POST                                                                                                                                                                                      |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                                                                          |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast/verify/{your-channel-id}&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple)                             |
| Header     | Authorization : Bearer \[generatedToken]                                                                                                                                                  |
| Body       | <p>\["{phone-number-1}", "{phone-number-2}" , .... ]</p><p></p><p><strong>Note</strong>: Phone number must filled with format '62' (country code) or '0',</p><p>Can't filled with '+'</p> |

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

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization: Bearer \[generatedToken]               |

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2F2EC6HCo3ipj0SslWckrO%2Fimage.png?alt=media&#x26;token=2ab5708f-dc1f-48cf-b177-e385fc048bb7" alt=""><figcaption><p>Send Broadcast Text</p></figcaption></figure>

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&#x20;

#### Body:

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FT9Wi9xcwf5jHwMNcws5q%2Fimage.png?alt=media&#x26;token=b7407710-d26e-4c32-b493-3a431a6fcfbd" alt=""><figcaption><p>Send Broadcast Text</p></figcaption></figure>

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

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization: Bearer \[generatedToken]               |

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2F3nRmXp2p5HhIyFwLxAnT%2Fimage.png?alt=media&#x26;token=87886311-ab76-4b1c-a4d9-d9f3d64f83af" alt=""><figcaption><p>Send Broadcast Image</p></figcaption></figure>

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.

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2Fl5djv22xhHWdV5UoeKIe%2Fimage.png?alt=media&#x26;token=c88468f0-ae14-4e29-b0e1-3258ba07c45d" alt=""><figcaption><p>Send Broadcast Image</p></figcaption></figure>

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

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization: Bearer \[generatedToken]               |

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FsmbOeU7P4GScAWhAa6MU%2Fimage.png?alt=media&#x26;token=2f868069-73f4-4b0c-ab11-a90311aeaea6" alt=""><figcaption><p>Send Broadcast Video</p></figcaption></figure>

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.

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2Fkgs7QmMGIUyEtmA4d9DV%2Fimage.png?alt=media&#x26;token=3fda17a2-9ada-42c1-b071-bf3b60d6fccc" alt=""><figcaption><p>Send Broadcast Video</p></figcaption></figure>

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

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization : Bearer \[generatedToken]              |

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2Fcu710I3Dy73Ijj1QLn2C%2Fimage.png?alt=media&#x26;token=ee9b9fa4-0f13-4265-beb5-37c98ecbda83" alt=""><figcaption><p>Send Broadcast Document</p></figcaption></figure>

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.

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FbolmrEbbssUkFJtLRnI4%2Fimage.png?alt=media&#x26;token=6d95a832-9063-4ce7-87d9-b51e5c61dcbb" alt=""><figcaption><p>Send Broadcast Document</p></figcaption></figure>

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

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization : Bearer \[generatedToken]              |

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FgpMzhbWyflVOtuNLoHo3%2Fimage.png?alt=media&#x26;token=c5b7a94a-c07d-4092-9c1b-a32af9b4bafd" alt=""><figcaption><p>Send Broadcast Quick Reply</p></figcaption></figure>

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.

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FZkHOzizPUALZw3r2dRV5%2Fimage.png?alt=media&#x26;token=d2b50aab-e59d-4d2e-b369-305c9ae3faf3" alt=""><figcaption><p>Send Broadcast Quick Reply</p></figcaption></figure>

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

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization : Bearer \[generatedToken]              |

#### 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
}
```

| Field            | Description                                                                                             |
| ---------------- | ------------------------------------------------------------------------------------------------------- |
| Variables Object | Variables Object is required object for template that has macro. The object has key and value component |
| Key              | This key refer to macro that available in broadcast template, example : {0}, {1}, {2}                   |
| Value            | Value refer to field we define in recipient file, as shown below                                        |

Example of macro variable:

![Macro Variable](https://765826444-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNQidQwa-0K9_KnQpoc%2F-MWTdTlrAlg3AOoJ5cHl%2F-MWTfEdCbL19QtKXYrfg%2Fimage.png?alt=media\&token=1cf5aae2-2207-4bfc-b371-c46c6528826c)

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

![recipient-file.xlsx](https://765826444-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNQidQwa-0K9_KnQpoc%2F-MWTdTlrAlg3AOoJ5cHl%2F-MWTfUyr_dVQAtknoDX6%2Fimage.png?alt=media\&token=f8ab6a52-4470-4570-8dd2-05a4c614c69b)

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.

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FxcXEKxyCCPijQyw0lLi9%2Fimage.png?alt=media&#x26;token=a0d2b66d-8209-4514-8d82-046219cdbb14" alt=""><figcaption><p>Send Broadcast Macro in Body</p></figcaption></figure>

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.

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2F40EDeOiCeaRXfOqTb1G9%2Fimage.png?alt=media&#x26;token=084213c3-37c6-4a60-8f87-5eb0f33c0a36" alt=""><figcaption><p>Send Broadcast Macro in Body</p></figcaption></figure>

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:**

| Field            | Description                                                                                             |
| ---------------- | ------------------------------------------------------------------------------------------------------- |
| Variables Object | Variables Object is required object for template that has macro. The object has key and value component |
| Key              | This key refer to macro that available in broadcast template, example : {0}, {1}, {2}                   |
| Value            | Value refer to field we define in recipient file, as shown below                                        |

Example of macro variable:

![Macro Variable](https://765826444-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNQidQwa-0K9_KnQpoc%2F-MWTdTlrAlg3AOoJ5cHl%2F-MWTfEdCbL19QtKXYrfg%2Fimage.png?alt=media\&token=1cf5aae2-2207-4bfc-b371-c46c6528826c)

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

![recipient-file.xlsx](https://765826444-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNQidQwa-0K9_KnQpoc%2F-MWTdTlrAlg3AOoJ5cHl%2F-MWTfUyr_dVQAtknoDX6%2Fimage.png?alt=media\&token=f8ab6a52-4470-4570-8dd2-05a4c614c69b)

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

#### Body:

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization : Bearer \[generatedToken]              |

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

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2Fj3tUbSns1i3SBkjfRXmB%2Fimage.png?alt=media&#x26;token=9372b8b7-f2bc-44c9-b17b-86ec18e536f1" alt=""><figcaption><p>Example Send Broadcast Macro in Header and Body</p></figcaption></figure>

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:

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FQLEqnNGio4m3Y3Mc3LfE%2Fimage.png?alt=media&#x26;token=73ef27e3-edb8-42b6-8faa-8f06ad5b4ef4" alt=""><figcaption><p>Send Broadcast Macro in Header and Body</p></figcaption></figure>

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.&#x20;

| Method     | POST                                                                                                                                          |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                              |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast/multiple&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple) |
| Header     | Authorization: Bearer \[generatedToken]                                                                                                       |

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

| Method     | GET                                                                                                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                            |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast/detail&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple) |
| Header     | <p>Authorization : Bearer \[generatedToken]</p><p>Broadcast id: \[broadcast id]</p>                                                         |

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

{% hint style="info" %}
Broadcast template id must be created first in order to use WhatsApp broadcast API.
{% endhint %}

| Method       | POST                                                                                                                            |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| Content Type | application/json                                                                                                                |
| URL          | https\://\[server]/graph/broadcast/whatsapp&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple) |
| Header       | Authorization : Bearer \[generatedToken]                                                                                        |

#### 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"
        }
    ]
}
```
