Sending Broadcast

Use this api to send Broadcast.

To send a broadcast, make a POST call to /broadcasts

Parameters

This is the main parameter used in send broadcast requests:

NameDescription

name

Required

Name of the Broadcast.

type

Required

Type for the recipient broadcast

Here are supported type:

  • contact
  • label

to

Required

If type is contact, here are some examples of supported phone number formats:

  • +1-000-000-0000
  • +1 (000) 000-0000
  • +1 000 000 0000
  • +1 (000) 000 0000

If type is label, only existing id labels are supported. Here are some example format:

  • 1
  • 2
  • 3

template

Required
A template object.

template.name

Required

Name of message template.

template.language

Required

Language of message template.

template.param

Required
A template param object.

template.param.header

Optional

A template param header array

Required

when contain header component in message template

template.param.body

Optional

A template param body array

Required

when contain variable {{number}} in message template body

template.param.button

Optional

A template param button array

Required

when contain button component in message template

template.param.button.*.type

Optional
Indicates the type of parameter for the button.

Supported values:

  • QUICK_REPLY
  • URL
  • COPY_CODE

Required

when contain button component in message template

template.param.button.*.value

Optional

QUICK_REPLY: Developer-defined payload that is returned when the button is clicked in addition to the display text on the button.

URL: Developer-provided suffix that is appended to the predefined prefix URL in the template.

COPY_CODE: Developer-defined code to be copied to the device's clipboard when tapped by the app user

Required

when contain button component in message template

template.param.limited_time_offer

Optional

A limited time offer object

Required

when limited time offer expiration time is set true

template.param.limited_time_offer.expiration_time

Optional

Offer code expiration time as a UNIX timestamp in milliseconds.

Required

when limited time offer expiration time is set true

Example

Sample request:

curl -X POST 'https://waofficial.botika.online/api/whatsapp/v1/broadcasts' \
-H 'Authorization: Bearer {{ API_TOKEN }}' \
-H 'Content-Type: application/json' \
-d '{
    "name: "BROADCAST_NAME",
    "type": "RECIPIENT_TYPE",
    "to": [
        # if type is contact
        "+62821xxxxxx",
        "+62821xxxxxx",
        # if type is label
        "1",
        "2",
        "3",
    ],
    "template": {
        "name": "MESSAGE_TEMPLATE_NAME",
        "language": "MESSAGE_TEMPLATE_LANGUAGE_CODE",
        "param": {
            "header": [
                "param for header" || <media_link>
            ],
            "body": [
                "Param for body",
                "Param for body",
                "Param for body",
                ......
            ],
            "button": [
                {
                    "type": "QUICK_REPLY" | "URL" | "COPY_CODE",
                    "value": "PAYLOAD"
                },
                {
                    "type": "QUICK_REPLY" | "URL" | "COPY_CODE",
                    "value": "PAYLOAD"
                }
                ....
            ],
            # if limited time offer expiration time is set true
            "limited_time_offer": {
                "expiration_time_ms": "<unix_timestamp_in_miliseconds>"
            }
        }
    }
}'

A successful response includes an object with an identifier for the message:

[
    'success' => true
]

Copyright © 2023 Botika Teknologi Indonesia