Send a message if subscribed

Send a message to a subscriber if that subscriber is subscribed to the channel. If the subscriber is not subscribed, status code 405 (Method Not Allowed) will be returned.

Resource URL:

POST https://api.essential.to/v2/account/channels/{channel_sid}/subscribers/{subscriber_number_or_sid}/messages

Resource information:

Response formatJSON
Requires authentication?Yes

Parameters:

body
required

The body of the message.

media_urls
optional

Collection of URLs pointing to media. These will be sent with an MMS. If providing media_urls, body may be omitted.

transport
optional

The SID or endpoint representing the Transport via which this message should be sent. Aliased as from.

protocol
optional

Request the type of transport by which this message will be sent, without specifying one in particular. The requested protocol is not guaranteed.

Acceptable values are short and long.

onstatus_url
optional

Endpoint to which Essential will send callbacks when the message status changes.

is_template
optional

Whether or not the body should be evaluated as a Message Template. Default is false.

Sample code:

curl -X POST \
  -u '[SID]:[TOKEN]' \
  -H 'Content-Type: application/json' \
  'https://api.essential.to/v2/account/channels/p03Gjl8Uzn0RkZSpHXHnrw/subscribers/p03Gjl8Uzn0RkZSpHXHnrw/messages' \
  -d '{"body":"Hello subscriber."}'

# Sample response
{
  "status": "queuing",
  "body": "Hello subscriber.",
  "media_urls": null,
  "notified_received_at": null,
  "notified_received_result": null,
  "onstatus_url": null,
  "notified_status_at": null,
  "notified_status_result": null,
  "status_updated_at": "2017-02-23T00:29:05.756Z",
  "created_at": "2017-02-23T00:29:05.760Z",
  "updated_at": "2017-02-23T00:29:05.760Z",
  "delivery_attempts": 0,
  "delivery_attempted_at": null,
  "msecs_in_flight": 0,
  "received_at": null,
  "dr_received_at": null,
  "sid": "ZYYYX5Z7EJQ8p08lNMSBnQ",
  "account_sid": "p03Gjl8Uzn0RkZSpHXHnrw",
  "channel_sid": "p03Gjl8Uzn0RkZSpHXHnrw",
  "transport_sid": "p03Gjl8Uzn0RkZSpHXHnrw",
  "subscriber_sid": "p03Gjl8Uzn0RkZSpHXHnrw",
  "to": "+12055551212",
  "from": "+12056666666"
}
Python coming soon.
Node coming soon.