Mailrelay API Reference

Send SMS campaign

POST /sms/campaigns/{id}/send_all

This method is used to send a SMS campaign to groups or a text_list. It will return some attributes, including the ID of the SMS sent campaign which can be used to check the progress and results of the SMS campaign.

If you specify a callback URL, we will send a POST request right after the SMS sent campaign is processed. It will contain a JSON with the type of the callback and the ID of the SMS sent campaign.

You can use the following command to simulate a callback request:

curl --request POST \
  --url https://your-callback-domain.com/callback-url \
  --header 'content-type: application/json' \
  --data '{"type":"sms_sent_campaign_finished","id":1}'

Parameters

NameTypeDescription
id integer ID of the record
target string Allows you to specify to whom this campaign will be sent
recipients array Should only be specified when target is set to text_list. Send an array with recipients using E.164 format.
group_ids array Groups IDs. This is required if target is set to groups. It should be an array of group ids. Example: [1, 4, 5]
scheduled_at string Allows you to send campaign later. If you want to send it immediately, do not send this parameter. This parameter should be in UTC timezone with the following format: YYYY-MM-DD HH:MM:SS.
callback_url string A URL that will be called after the campaign is sent. A POST request will be sent to this URL with a JSON payload containing the ID of the sent campaign.

Responses

StatusDescription
200 Success
400 The request is invalid. Check if the field names in the request and the request data is valid.
422 A validation error occurred. Check the response body for more information.
401 The API key wasn't sent or is invalid
500 An internal error happened. Try again later.