Skip to contentSkip to navigationSkip to topbar
On this page

twilio/quick-reply


The twilio/quick-reply content type lets recipients tap, rather than type, to respond to a message. You can include up to ten quick-reply buttons. When you send an in-session WhatsApp message that does not require template approval, only three buttons are allowed.

(warning)

Warning

twilio/quick-reply content templates can be sent over WhatsApp for out-of-session messages that include variables. If the template body starts or ends with a variable, or if two variables appear adjacent to each other, WhatsApp will reject the template. A sample value for each variable is required. For details, see Using Variables with Content Templates.


Supported channels

supported-channels page anchor
  • WhatsApp
  • Facebook Messenger

Owl Air Support chat offers options to Check Flight Status, Check Gate Number, or Speak with an Agent.
Chat interface greeting from Owl Air Support with options to check flight status, gate number, or see all options.
All Options menu showing flight status, gate number, agent contact, and weather at DEP and ARR.

ParameterTypeRequiredVariable supportDescription
bodystringYesYesText that appears above the quick-reply buttons.
Maximum length: 1,024 characters.
actionsarrayYesYesAn array that contains between 1 and 10 quick-reply buttons.

actions properties

actions-properties page anchor

For an overview of shared properties, see Common components.

PropertySupported channelsParameters
QUICK_REPLY
  • WhatsApp
  • Facebook Messenger
  • title: Text that appears on the button. The same text is returned in the inbound Body and ButtonText fields when the end user selects the button. Variables are supported for in-session messages.
    Maximum length: 20 characters.
  • id: A developer-defined payload that is not visible to the end user. The value is returned in the inbound ButtonPayload field when the end user selects the button. Variables are supported.
    Maximum length: 200 characters.

Code examples and responses

code-examples-and-responses page anchor
Create a quick-reply templateLink to code sample: Create a quick-reply template
1
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
2
3
using System;
4
using Twilio;
5
using Twilio.Rest.Content.V1;
6
7
TwilioClient.Init(accountSid, authToken);
8
9
// define the twilio/text type for less rich channels (e.g. SMS)
10
var twilioText = new TwilioText.Builder();
11
twilioText.WithBody("Hi {{1}}. Thanks for contacting Owl Air Support. How can we help?");
12
13
// define the twilio/quick-reply type for more rich channels
14
var twilioQuickReply = new TwilioQuickReply.Builder();
15
twilioQuickReply.WithBody("Owl Air Support");
16
var quickreply1 = new QuickReplyAction.Builder()
17
.WithTitle("Contact Us")
18
.WithId("flightid1")
19
.Build();
20
var quickreply2 = new QuickReplyAction.Builder()
21
.WithTitle("Check gate number")
22
.WithId("gateid1")
23
.Build();
24
var quickreply3 = new QuickReplyAction.Builder()
25
.WithTitle("Speak with an agent")
26
.WithId("agentid1")
27
.Build();
28
twilioQuickReply.WithActions(new List<QuickReplyAction>() { quickreply1, quickreply2, quickreply3 });
29
30
// define all the content types to be part of the template
31
var types = new Types.Builder();
32
types.WithTwilioText(twilioText.Build());
33
types.WithTwilioQuickReply(twilioQuickReply.Build());
34
35
// build the create request object
36
var contentCreateRequest = new ContentCreateRequest.Builder();
37
contentCreateRequest.WithTypes(types.Build());
38
contentCreateRequest.WithLanguage("en");
39
contentCreateRequest.WithFriendlyName("owl_air_qr");
40
contentCreateRequest.WithVariables(new Dictionary<string, string>() { {"1", "John"} });
41
42
// create the twilio template
43
var contentTemplate = await CreateAsync(contentCreateRequest.Build());
44
45
Console.WriteLine($"Created Twilio Content Template SID: {contentTemplate.Sid}");

Output

1
{
2
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"date_created": "2022-08-29T10:43:20Z",
4
"date_updated": "2022-08-29T10:43:20Z",
5
"friendly_name": "owl_air_qr",
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
"twilio/quick-reply": {
17
"body": "Hi, {{ 1 }}. \n Thanks for contacting Owl Air Support. How can I help?",
18
"actions": [
19
{
20
"id": "flightid1",
21
"title": "Check flight status"
22
},
23
{
24
"id": "gateid1",
25
"title": "Check gate number"
26
},
27
{
28
"id": "agentid1",
29
"title": "Speak with an agent"
30
}
31
]
32
}
33
},
34
"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
35
"variables": {
36
"1": "Owl Air Customer"
37
}
38
}