Twilio/text
type contains only plain text-based content. While text content may be sent to OTT channels without the use of content templates, the twilio/text
type can be used as a fallback content type when sending to a mix of channels. Additionally, templates offer variables to create dynamic content.
Twilio/text templates can be sent via WhatsApp for out of session messages with variables. If the template's body starts or ends with a variable or has two variables next to each other, the template will not be approved by WhatsApp without a sample variable. For additional information about variables see Using Variables with Content Templates.
SMS, WhatsApp, Facebook Messenger
body:
Type: string
Required: yes
Variable Support: yes
Description: The text of the message you want to send.
1// Install the C# / .NET helper library from twilio.com/docs/csharp/install23using System;4using Twilio;5using Twilio.Rest.Content.V1;67TwilioClient.Init(accountSid, authToken);89// define the twilio/text10var twilioText = new TwilioText.Builder();11twilioText.WithBody("Hi {{1}}. Thanks for contacting Owl Air Support. How can we help?");1213// define all the content types to be part of the template14var types = new Types.Builder();15types.WithTwilioText(twilioText.Build());1617// build the create request object18var contentCreateRequest = new ContentCreateRequest.Builder();19contentCreateRequest.WithTypes(types.Build());20contentCreateRequest.WithLanguage("en");21contentCreateRequest.WithFriendlyName("text_template");22contentCreateRequest.WithVariables(new Dictionary<string, string>() { {"1", "John"} });2324// create the twilio template25var contentTemplate = await CreateAsync(contentCreateRequest.Build());2627Console.WriteLine($"Created Twilio Content Template SID: {contentTemplate.Sid}");
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"date_created": "2022-09-01T12:39:19Z",4"date_updated": "2022-09-01T12:39:19Z",5"friendly_name": "media_template",6"language": "en",7"links": {8"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",9"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"10},11"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",12"types": {13"twilio/text": {14"body": "Hi, {{1}}. \n Thanks for contacting Owl Air Support. How can I help?."15}16},17"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",18"variables": {19"1": "name"20}21}