# Create SMS campaign

You can create a new SMS campaign.

POST /sms-campaign/

Attributes Type Required Description
description string no A description of the SMS campaign.
eta string no A datetime when a campaign should be sent. If not provided, the campaign will be sent right away.
name string yes A SMS campaign name.
phone_number string yes A phone number where SMS will be sent
recipients object no A list of user_ids.
recipients_count integer no A number of recipients.
status integer no A status of your campaign (1 - draft, 2 - active, 3 - finished, 4- archived).
type integer no A type of SMS campaign (1 - simple, 2 - automated).

# Request

  • CURL
  • JavaScript
  • PHP
  • Python
curl -X POST
  "https://<your_app_subdomain>.user.com/api/public/sms-campaign/"
  -H 'Authorization: Token <your_64_char_api_key>'
  -H 'Cache-Control: no-cache'
  -H 'Content-Type: application/json'
  -d '{
    "name": "Sample SMS campaign",
    "phone_number": {
        "provider": "Phone number provider",
        "phone_number": "123123123",
        "name": "Custom name of your phone number"
    },
    "recipients": [1,2,3,4]
}'

# Response

{
    "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"
}