ContentTemplates
Create, update, delete, and query Content templates in Twilio.
Table-Specific Information
The ContentTemplates table exposes the Content templates in your Twilio account. A Content template lets you define a message once and send it across channels such as SMS, WhatsApp, and Facebook Messenger. To send a template, pass its Sid to the ContentTemplateSid input of the SendMessage stored procedure.
The add-in expects a JSON document for the Types and Variables columns. Types defines the body of the template for each channel, such as twilio/text or twilio/quick-reply. Variables supplies a default value for each placeholder in the body. Placeholders are written as {{1}}, {{2}}, and so on, and are replaced at send time by the ContentTemplateVariables input of SendMessage.
SELECT
The add-in uses the Twilio API to process WHERE clause conditions built with the following columns and operators. The rest of the filter is executed client-side within the add-in.
- Sid supports the = operator.
For example, the following queries are processed server-side:
SELECT * FROM ContentTemplates;
SELECT * FROM ContentTemplates WHERE Sid = 'HX13cc1b73677f8ead76782b1ecec13299';
INSERT
To add a Content template, specify at least Language and Types.
INSERT INTO ContentTemplates (FriendlyName, Language, Types) VALUES ('owl_air_qr', 'en', '{"twilio/text": {"body": "Hi, {{1}}. Thanks for contacting Owl Air Support."}}')
Set Variables to give each placeholder a default value. If you plan to submit the template for WhatsApp approval, use self-evident defaults, because WhatsApp treats them as sample values during the review.
INSERT INTO ContentTemplates (FriendlyName, Language, Types, Variables) VALUES ('owl_air_qr', 'en', '{"twilio/text": {"body": "Hi, {{1}}. Thanks for contacting Owl Air Support."}}', '{"1": "Owl Air Customer"}')
UPDATE
Specify Sid in the WHERE clause. You can update FriendlyName, Language, Types, and Variables. Twilio does not allow you to update a template after you submit it for WhatsApp approval.
UPDATE ContentTemplates SET FriendlyName = 'owl_air_qr_v2', Types = '{"twilio/text": {"body": "Hello."}}' WHERE Sid = 'HX13cc1b73677f8ead76782b1ecec13299'
DELETE
Specify Sid in the WHERE clause.
DELETE FROM ContentTemplates WHERE Sid = 'HX13cc1b73677f8ead76782b1ecec13299'
Columns
| Name | Type | ReadOnly | References | Description |
| Sid [KEY] | String | True |
The unique string that identifies the Content resource. | |
| AccountSid | String | True |
The SID of the Account that created the Content resource. | |
| DateCreated | Datetime | True |
The date and time the Content resource was created. | |
| DateUpdated | Datetime | True |
The date and time the Content resource was last updated. | |
| FriendlyName | String | False |
The string name used to describe the Content resource. | |
| Language | String | False |
The BCP-47 language code for the Content resource, such as en or fr. | |
| Types | String | False |
The content types and their definitions for the Content resource, such as twilio/text or twilio/quick-reply. | |
| Variables | String | False |
The key-value pairs of the variables and their default values for the Content resource. | |
| Url | String | True |
The absolute URL of the Content resource. | |
| LinksApprovalCreate | String | True |
The URL to submit the Content resource for WhatsApp approval. | |
| LinksApprovalFetch | String | True |
The URL to fetch the approval status of the Content resource. |