Send a message using the SMS channel.

Overview

The Create Notification API allows you to send push notifications, emails, and SMS to your users. This guide is specific for SMS. See Push notification or Email to send to those channels.

This API can send SMS and MMS messages to your phone number Subscriptions. If a user does not have an existing Subscription, create one using the Create Subscription API.

How to use this API

To start with this API, ensure your application is properly configured by following the SMS Setup guide.

Craft your SMS or MMS message

  1. Draft the message and embed it in the contents parameter.
  2. (Optional) Provide the phone number to send the SMS from in the sms_from parameter.
  3. Refer to SMS channel parameters for additional parameters.

Choose a targeting strategy

Choose only one strategy for targeting users with this message:

  • Segments
  • Filters
  • Aliases

Schedule delivery

You can specify rate limits and delivery timing as well. See Delivery Notification Parameters to learn more.



Body Parameters

sms_from

Type string

Description

The phone number used to send the SMS or MMS message. Defaults to the number selected in SMS Setup.

The phone number must be specified using the E.164 format.

Example

{
  "sms_from": "+15558675309"
}

contents

Type object

Description

The text message's content.

Limit each localized message's content to

Example

{
  "contents": { 
    "en": "Welcome to Cat Facts!"
  }
}

sms_media_urls

Type string[]

Description

URLs for the media files to be attached to the text message. Your from_number must support sending MMS messages.

You may include 10 media URLs totaling up to 5 Megabytes in size.

Example

{
  "sms_media_urls": ["https://cat.com/cat.png", "https://cat.com/cat.gif"]
}

include_phone_numbers

Type string[]

Description

Allows targeting users based on their phone number in E.164 format. If a phone subscription does not exist for the app, a subscription will be automatically created for that phone number. See Import Phone Numbers for other ways to import phone numbers .

You may include up to 2,000 phone numbers in E.164 format per API call.

Example

{
  "include_phone_numbers": [
    "+19999999999"
  ]
}

Language