Skip to contentSkip to navigationSkip to topbar
On this page

twilio/list-picker


Twilio/list-picker includes a menu of up to 10 options for users to make a selection.

(information)

Info

List-picker templates are only available once the end user is in a 24 hr session. They can not initiate a business initiated session.

List-picker templates are not supported for approval on WhatsApp and can't be submitted for approval.


Supported Channels

supported-channels page anchor

WhatsApp


Message 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 1024 characters

button:

  • Type: string

  • Required: yes

  • Variable Support: yes

  • Description: Display value for the primary button.

    • It cannot be an empty string and must be unique within the message.

items:

  • Type: array[List Items]

  • Required: yes

  • Variable Support: See List Item definition below.

  • Description: Array of list item objects.

    • Minimum: 1 item; maximum: 10 items

item:

  • Type: string

  • Required: yes

  • Variable Support: yes

  • Description: Display value for the item

    • Maximum: 24 characters

id:

  • Type: string

  • Required: yes

  • Variable Support: yes

  • Description: Unique item identifier. Not visible to the recipient.

    • Maximum: 200 characters

description:

  • Type: string

  • Required: no

  • Variable Support: yes

  • Description: Description of the item.

    • Maximum: 72 characters
Create a List Picker TemplateLink to code sample: Create a List Picker 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/list-picker
10
var twilioListPicker = new TwilioListPicker.Builder();
11
twilioListPicker.WithBody("Owl Air Flash Sale! Hurry! Sale ends on {{1}}!");
12
var item1 = new ListPickerItems.Builder()
13
.WithItem("SFO to NYC for $299")
14
.WithDescription("Owl Air Flight 1337 to LGA")
15
.WithId("SFO1337")
16
.Build();
17
var item2 = new ListPickerItems.Builder()
18
.WithItem("OAK to Denver for $149")
19
.WithDescription("Owl Air Flight 5280 to DEN")
20
.WithId("OAK5280")
21
.Build();
22
var item3 = new ListPickerItems.Builder()
23
.WithItem("LAX to Chicago for $199")
24
.WithDescription("Owl Air Flight 96 to ORD")
25
.WithId("LAX96")
26
.Build();
27
twilioListPicker.WithItems(new List<ListPickerItems>() { item1, item2, item3 });
28
29
// define all the content types to be part of the template
30
var types = new Types.Builder();
31
types.WithTwilioListPicker(twilioListPicker.Build());
32
33
// build the create request object
34
var contentCreateRequest = new ContentCreateRequest.Builder();
35
contentCreateRequest.WithTypes(types.Build());
36
contentCreateRequest.WithLanguage("en");
37
contentCreateRequest.WithFriendlyName("owl_sale_list");
38
contentCreateRequest.WithVariables(new Dictionary<string, string>() { {"1", "end_date"} });
39
40
// create the twilio template
41
var contentTemplate = await CreateAsync(contentCreateRequest.Build());
42
43
Console.WriteLine($"Created Twilio Content Template SID: {contentTemplate.Sid}");

Output

1
{
2
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"date_created": "2022-08-29T15:46:11Z",
4
"date_updated": "2022-08-29T15:46:11Z",
5
"friendly_name": "owl_air_list",
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/list-picker": {
14
"body": "Owl Air Flash Sale! Hurry! Sale ends on {{1}}!",
15
"button": "Select a destination",
16
"items": [
17
{
18
"description": "Owl Air Flight 1337 to LGA",
19
"id": "SFO1337",
20
"item": "SFO to NYC for $299"
21
},
22
{
23
"description": "Owl Air Flight 5280 to DEN",
24
"id": "OAK5280",
25
"item": "OAK to Denver for $149"
26
},
27
{
28
"description": "Owl Air Flight 96 to ORD",
29
"id": "LAX96",
30
"item": "LAX to Chicago for $199"
31
}
32
]
33
},
34
"twilio/text": {
35
"body": "We have flights to the following destinations: (1) SFO, (2) OAK, (3) LAX. Hurry! Sale ends on {{1}}!"
36
}
37
},
38
"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
39
"variables": {
40
"1": "end_date"
41
}
42
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.