Skip to main content
POST/sms-campaign/

Create SMS campaign

You can create a new SMS campaign.

caution

This endpoint needs a Twilio sender number (phone_number, with provider "Twilio"), and User no longer offers Twilio. It works only in workspaces that still have a Twilio number. Otherwise, create SMS campaigns in the panel; you can still list, read and delete them through the API.

Attributes

Optional unless marked required

namestringrequired
Name of the campaign, up to 64 characters.
phone_numberobjectrequired
Sender number of the campaign: an object with provider ("Twilio", the only accepted value), phone_number (the number, up to 100 characters) and name (up to 64 characters); country, description, sms and voice are optional. Use a Twilio number the workspace already has: a number it doesn't have yet is added as a new phone number and the workspace's call center balance is charged for it.
descriptionstring
Description of the campaign.
recipientsarray of integers
Contact IDs (id from the User model) to send the campaign to. Contacts without a phone number are skipped, and contacts sharing a phone number count once.
etastring (date-time)
When sending starts, ISO 8601. Creating a campaign through the API doesn't send it; it is sent from the panel, and without eta sending starts as soon as it's sent there.
typeinteger
1 simple (default), sent once to recipients; 2 automation, sent by automation actions (its recipients are cleared).
statusinteger
1 draft (default), 2 active or 3 archived. Setting it doesn't send the campaign, and only drafts can be changed later with Add recipient SMS campaign.
folderinteger
ID of an SMS campaign folder to put the campaign in.

Request​

curl -X POST "https://<your_app_subdomain>.user.com/api/public/sms-campaign/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"name": "Spring sale SMS",
"phone_number": {
"provider": "Twilio",
"phone_number": "+48500100200",
"name": "Main sender"
},
"recipients": [
1,
2,
3,
4
]
}'

Response examples​

{
"id": 8,
"name": "Sample SMS campaign",
"description": "",
"app": 1,
"phone_number": {
"id": 3,
"app": 1,
"provider": "Phone number provider",
"country": "",
"phone_number": "123123123",
"name": "Custom name of your phone number",
"description": "",
"sms": false,
"voice": false,
"price": "0.00",
"last_used_at": null,
"created_at": "2018-02-19T13:01:41.083625Z",
"updated_at": "2018-02-19T13:01:41.083655Z",
"record_incoming_calls": false
},
"type": 1,
"eta": null,
"status": 1,
"recipients": [
1,
2,
3,
4
],
"recipients_ids": "[1,2,3,4]",
"recipients_count": 4,
"started_at": null,
"last_message_sent_at": null,
"finished_at": null,
"author": 1,
"created_at": "2018-02-19T13:01:41.097096Z",
"updated_at": "2018-02-19T13:01:41.097126Z"
}
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.