Order of calls
1
Use an approved template
create_broadcast takes templateName and language. The template must already be APPROVED. The result is a PENDING draft. It does not send. The audience can be a label, not only phone numbers. Pass label ids in labelIds as an array from list_labels, such as ["6ae4e79ba57aedb415d2d1aa"]. Pass a name in label or labels, such as onboard_29oct. Ids and names can be sent together. Do not wrap the labelIds array in quotes. Every contact with that label is included except contacts who opted out. contactPhones (up to 1,000 numbers with country codes) is optional when a label is set. Each {{name}} placeholder uses the same choices as the dashboard. A string in variables is the same value for everyone. From a contact is { "mode": "contact_field", "contactField": "firstName", "emptyBehavior": "skip" }. contactField is firstName, lastName, phoneNumber, or an attribute id or name from list_attributes. emptyBehavior is default with emptyDefault, or skip so that contact is not sent the message. If the customer has not chosen, the tool returns needsInput and the assistant asks before saving. For an image, video, or document header, useTemplateHeader: true uses the template sample. headerMediaUrl is a different public https file. The assistant asks which one when the customer has not said. Pass phoneNumberRef when the account has more than one number.2
Preview
preview_broadcast counts recipients. The assistant shows you that count. schedule_broadcast stays blocked until you accept it.3
Schedule
schedule_broadcast takes scheduledDateTime. The time is at least 5 minutes from now and within 30 days. A past time, a time inside the next 5 minutes, or a time past 30 days is rejected. The assistant calls this only after you ask.list_broadcasts and get_broadcast read drafts and scheduled sends. list_broadcast_deliveries returns one row per recipient. Filter with status, page (starting at 1), and limit up to 200.
delete_broadcast deletes a broadcast that is still PENDING or QUEUED, and a finished broadcast that never had recipients. A broadcast that has started, was sent, or is inside the last minute before it starts cannot be deleted.
