Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

twilio/quick-reply


Twilio/quick-reply templates let recipients tap, rather than type, to respond to the message.

(warning)

Warning

Twilio/quick-reply 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.


Supported Channels

supported-channels page anchor

WhatsApp, Facebook Messenger


Content API - quick reply preview.

body:

  • Type: string
  • Required: yes
  • Variable Support: yes
  • Description: The text of the message you want to send. This is included as a regular text message.

    • Maximum 640 characters

actions:

  • Type: array[ actions ]
  • Required: yes
  • Variable Support: See Common Components: Actions definition
  • Description: Buttons that recipients can tap on to act on the message:

    • Up to 3 buttons can be created for Quick Reply buttons. Please use "type," "title", and "id" actions to create quick reply buttons within the actions array.

Create a Quick Reply Template

create-a-quick-reply-template page anchor
C#
Java
curl

_45
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
_45
_45
using System;
_45
using Twilio;
_45
using Twilio.Rest.Content.V1;
_45
_45
TwilioClient.Init(accountSid, authToken);
_45
_45
// define the twilio/text type for less rich channels (e.g. SMS)
_45
var twilioText = new TwilioText.Builder();
_45
twilioText.WithBody("Hi {{1}}. Thanks for contacting Owl Air Support. How can we help?");
_45
_45
// define the twilio/quick-reply type for more rich channels
_45
var twilioQuickReply = new TwilioQuickReply.Builder();
_45
twilioQuickReply.WithBody("Owl Air Support");
_45
var quickreply1 = new QuickReplyAction.Builder()
_45
.WithTitle("Contact Us")
_45
.WithId("flightid1")
_45
.Build();
_45
var quickreply2 = new QuickReplyAction.Builder()
_45
.WithTitle("Check gate number")
_45
.WithId("gateid1")
_45
.Build();
_45
var quickreply3 = new QuickReplyAction.Builder()
_45
.WithTitle("Speak with an agent")
_45
.WithId("agentid1")
_45
.Build();
_45
twilioQuickReply.WithActions(new List<QuickReplyAction>() { quickreply1, quickreply2, quickreply3 });
_45
_45
// define all the content types to be part of the template
_45
var types = new Types.Builder();
_45
types.WithTwilioText(twilioText.Build());
_45
types.WithTwilioQuickReply(twilioQuickReply.Build());
_45
_45
// build the create request object
_45
var contentCreateRequest = new ContentCreateRequest.Builder();
_45
contentCreateRequest.WithTypes(types.Build());
_45
contentCreateRequest.WithLanguage("en");
_45
contentCreateRequest.WithFriendlyName("owl_air_qr");
_45
contentCreateRequest.WithVariables(new Dictionary<string, string>() { {"1", "John"} });
_45
_45
// create the twilio template
_45
var contentTemplate = await CreateAsync(contentCreateRequest.Build());
_45
_45
Console.WriteLine($"Created Twilio Content Template SID: {contentTemplate.Sid}");

Output

_38
{
_38
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"date_created": "2022-08-29T10:43:20Z",
_38
"date_updated": "2022-08-29T10:43:20Z",
_38
"friendly_name": "owl_air_qr",
_38
"language": "en",
_38
"links": {
_38
"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",
_38
"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"
_38
},
_38
"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"types": {
_38
"twilio/text": {
_38
"body": "Hi, {{ 1 }}. \n Thanks for contacting Owl Air Support. How can I help?."
_38
},
_38
"twilio/quick-reply": {
_38
"body": "Hi, {{ 1 }}. \n Thanks for contacting Owl Air Support. How can I help?",
_38
"actions": [
_38
{
_38
"id": "flightid1",
_38
"title": "Check flight status"
_38
},
_38
{
_38
"id": "gateid1",
_38
"title": "Check gate number"
_38
},
_38
{
_38
"id": "agentid1",
_38
"title": "Speak with an agent"
_38
}
_38
]
_38
}
_38
},
_38
"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"variables": {
_38
"1": "Owl Air Customer"
_38
}
_38
}


Rate this page: