Send Templates Created with the Content Editor
The Content Editor is not publicly available yet. To get access please fill out this form or contact your AE/SE.
The POST request to the Programmable Messaging API must include a Messaging Service that contains a sender.
We recommend including the Messaging Service in the From
field of the POST request. If your use case requires a Phone Number in the From
field, you can instead specify a MessagingServiceSid in the POST request. Please see the FAQ to reference an example cURL command.
Send Messages with a Messaging Service in the "From" field
There are multiple ways to send a template created with the Content API. One way is to add a Sender to a Messaging Service's Sender Pool and specify the Messaging Service Sid(MGXXXXXXXX) in the send request's From
field.
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages
Data Parameters
New parameters in the Programmable Messaging API:
ContentSid: Type - String Required - Yes if sending templates created in the Content API/Editor Description - Identifier for the preconfigured Content. |
Variables: Type - JSON string Required - No Description - Key-value pairs of variable names to substitution values. |
To send messages you will utilize the content SID message body and your Twilio account SID in the POST request URL. For templates that utilize variables, please specify these variables in the POST request to send messages.
Key Info
To: Type - Number Required - Yes Description - The location you send the message to.
|
From: Type - Sid Required - Yes Description - Messaging Service(MGXXXXXX). |
Body: Type - String Required - No Description - This is an optional field and will not affect the template. The body will be overwritten by the body of the Content template. |
How to add Channel Specific Senders to a Sender Pool
To add a specific channel's sender to a Messaging Service's Sender Pool, go to the Messaging Service and click edit. In the edit screen, there is a "Sender Pool" Section with the following options to add.
- Phone Number
- Short Code
- Alpha Sender
- WhatsApp Number
- Facebook Messenger(Public Beta) - If you do not see this option, file a support ticket asking to enable the following feature for your account: Enable the FBM messaging service setting to add FBM Senders to your existing Messaging Service. For more information about how to start using FBM check out this page.
Send Messages with a Phone Number in the "From" field
Another way to send messages is to use the phone number in the from field and specify a MessagingServiceSid field. This allows you to dedicate a From
field for compliance or any other reason. If you would like to utilize this method, you do not have to add the channel sender to the messaging service's sender pool, but a valid messaging service is still required.
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages
Data Parameters
New parameters in the Programmable Messaging API:
ContentSid: Type - String Required - Yes if sending templates created in the Content API/Editor Description - Identifier for the preconfigured Content. |
Variables: Type - JSON string Required - No Description - Key-value pairs of variable names to substitution values. |
To send messages you will utilize the content SID message body and your Twilio account SID in the POST request URL. For templates that utilize variables, please specify these variables in the POST request to send messages.
Key Info
To: Type - Number Required - Yes Description - The location you send the message to.
|
From: Type - Phone Number Required - Yes Description - Phone number of your sender. |
MessagingServiceSid: Type - Sid Required - Yes Description - Messaging Service(MG...XXX). |
Body: Type - String Required - No Description - This is an optional field and will not affect the template. The body will be overwritten by the body of the Content template. |
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.