V1 - Broadcast Messages
Send messages to multiple contacts on channels connected to CosmoBots
Last updated
Send messages to multiple contacts on channels connected to CosmoBots
Last updated
This document is intended to be used for developers using CosmoBots API to send messages to multiple contacts on channels connected to CosmoBots.
Remember that to send messages to these channels we are considering you already have connected the channel to your Bot on CosmoBots.
Login into the platform
Choose the Bot
On the left sidebar menu, choose Integrations, then API
Choose the Broadcast Messages API
Click on Enable API
Now you can copy channelId and token to use on the requests
Every request needs to have these two parameters on the header. You may retrieve both on the Integration section of the platform. Follow these steps:
Here are the body fields used during this request. The format is JSON.
Object
Array [Object]
Type: Text
Type: URL
Header
Type
Description
channel_id
String
Required. ID of the Channel that will receive the messages
token
String
Required. Token exclusive to the Bot, to be used on this API.
Field
type
Description
message
Object
Required. Information about the content of the message
contact
Array [Objects]
Required. Information about the contacts that will receive the messages.
Field
Type
Description
type
String
Required. Types of Message. Options are:
Text
Buttons
Cards
Media
template_id
String
ID of the Template being used to send the message
language_code
String
Code for the language of the message.
Ex.: "pt_BR"
params
Array [Strings]
When using Templates the values in this array represent the parameters values on messages for all contacts
data
Object
Required. Data related to the content of the message
Field
Type
Description
text
String
Text of the message
Field
Type
Description
title
String
Required. Text of the Button (Caption)
type
String
Required. Type of Button, having the value related to the field payload. Options are:
Text
Url
Payload
value
String
Required. Data related to the payload when the button is clicked
Field
Type
Description
title
String
Required. Title of the Card
subtitle
String
Subtitle of the Card
image_url
String
Image Url of the Card
buttons
Array [Object]
List of Buttons
Field
Type
Description
type
String
Required. Type of media. Options are:
Image
Audio
Video
Document
url
String
Required. Url of the Media
caption
String
Caption of the Media
Field
Type
Description
id
String
Required. ID of the Contact.
When the channel is WhatsApp, the id is equivalent to the phone number (complete format).
params
Array [Strings]
When using Templates the values in this array represent the parameters values on the template message for each contact.
context
Object
Custom Data related to the message, that can be used by the Bot during conversation.
Field
Type
Description
status
String
Status of the Message
Sent
Error
broadcast_id
String
ID of the Broadcast