Send a Message

Learn how create a request to the Mobile Text Alerts API that will send a message.

Messages are sent from your account’s default number. You can add dedicated numbers (10DLC, toll-free, or short code) if you need higher throughput or two-way messaging.

Ready to send your own content?

You may be restricted to sending templated message content if you’re still on a trial account and/or have an unverified phone number. Click here to learn how to get a verified number and start sending your own content.

Send a message with the Mobile Text Alerts API

Messages are sent via the API with POST requests to the /send endpoint. The request data must contain both recipient and content information.

Required Fields: (Must be one of the following from each)

  • Recipient(s):

    • subscriberIds: number[] - List of subscriber IDs of recipients. Messages can be sent to specific subscribers, with each subscriber assigned a unique subscriberId.

    • subscribers: (number | string)[] - List of recipient phone numbers or email addresses. A new subscriber will be created for new recipients that are not already subscribers on your account.

      • To ensure your messages are sent to the intended recipients this field must be formatted correctly based on how your subscribers are stored. E.164 formatted strings are recommended. See Phone Number Format Guide to learn more.

    • allSubscribers: boolean - Flag to indicate send message to all subscribers if true. When allSubscribers is set to true, no other recipient fields should be specified. Default value is false.

    • groups: number[] - List of group IDs of recipients. Messages can be sent to specific groups, with each group assigned a unique groupId.

    • threadId: number - Messages can be sent in reply to a thread, with each thread assigned a unique threadId.

  • Content:

    • message: string - The content of the message being sent.

    • image: string - The URL of an attachment for a message. This URL needs to be publicly accessible; this ensures Mobile Text Alerts can access it when sending. By default, messages with attachments will be sent as an MMS.

    • images:string[] - Use this field for multiple attachments, this is an array of image attachment URLs. Overrides image when present.

    • templateId: number - Messages can be saved as pre-set message templates for reuse with saved controlled templates on your account assigned a templateId. To retrieve the templates configured on your account, use the List Templates endpoint.

How to build a sample request to the API

Let's create a simple request to the /send endpoint.

1

Indicate the recipient(s)

You can send a message to a phone number as a test. Set the subscribers field to the recipient phone number.

2

Create message content

Write the content of the message to be sent.

3

Form API request

Create the API request to the /send endpoint. Remember to include Authorization header.

4

Receive Response

The API will return a message about the status of your request.

See Error Response Codes to learn about possible reasons your request may fail.

Learn more

Last updated

Was this helpful?