Create a WhatsApp campaign
POST/api/partner-gateway/campaigns
Creates a bulk WhatsApp campaign, as a draft or already marked ready to send. Nothing is sent until you confirm it.
- Channel: set
sendingModetoWHATSAPP, with the phone number (whatsappPhoneNumberId) and the template (whatsappTemplateId).WHATSAPP_SMStries WhatsApp first and falls back to SMS: it needssmsSenderandsmsBodytoo. - Recipients: contact lists in
contactListIds(destinationType0), phone numbers indestinations(destinationType1), or both (destinationType2). - Schedule: set
scheduledDateto a future time (yyyy-MM-dd HH:mm:ss.SSSZ) to send later. Without it the campaign is sent as soon as it is confirmed. - The number is checked against your account:
whatsappPhoneNumberIdmust be one of your WhatsApp numbers, and withWHATSAPP_SMSsmsSendermust be an approved sender. Nothing is created when a check fails. - Personalisation of the fallback SMS:
smsBodyaccepts placeholders in single braces named after your contact fields, such as{firstName}. - API key:
CAMPAIGNSopens every campaign. A key without it manages only the campaigns whosesendingModeuses its channel operations, all of them for a combined mode:SMScampaigns needSMS,RCS_SMScampaigns needRCSandSMS.
From draft to sending, step by step
- Create the campaign with
readyToSendfalse to save it as a draft. - Adjust it with
PUT /campaigns/{id}, as many times as you need. - Check the recipient count and the price with
GET /campaigns/{id}/price. - Set
readyToSendto true withPUT /campaigns/{id}when the configuration is final. - Confirm it with
PUT /campaigns/{id}/confirm: the campaign is priced, the amount is reserved and the sending starts, at once or at thescheduledDate.
Fields each sending mode needs
sendingMode | Fields |
|---|---|
WHATSAPP | whatsappPhoneNumberId and whatsappTemplateId: the template is loaded only when both are sent. |
WHATSAPP_SMS | The WhatsApp fields, plus smsSender and smsBody: WhatsApp is tried first, then SMS. |
WHATSAPP_RCS_SMS, RCS_WHATSAPP_SMS | The fields of all three channels, tried in the order of the name. The RCS ones are on Create an RCS campaign. |
WHATSAPP_RCS_SMS is stored and returned as RCS_WHATSAPP_SMS (RCS first) whenever rcsAgentId is set, which that mode needs before it can be confirmed.
POST /campaigns is one endpoint for SMS, RCS and WhatsApp: this page describes it for WhatsApp. See it for SMS or RCS.
Request
Responses
- 201
- 400
- 401
- 403
- 404
Campaign created, returned as stored with its id.
A required field is missing, sendingMode is not a valid value, or whatsappTemplateId is sent without whatsappPhoneNumberId.
The API key is missing or invalid, or holds neither CAMPAIGNS nor the operation of every channel of the campaign's sendingMode.
smsSender is not an approved sender of your account (see GET /sms/senders).
rcsTemplateId is not an enabled RCS template of your account, or whatsappPhoneNumberId is not one of your WhatsApp phone numbers.