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

twilio/list-picker


Twilio/list-picker includes a menu of up to 10 options, which offers a simple way 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 Template

create-a-list-picker-template page anchor
C#
Java
curl

_43
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
_43
_43
using System;
_43
using Twilio;
_43
using Twilio.Rest.Content.V1;
_43
_43
TwilioClient.Init(accountSid, authToken);
_43
_43
// define the twilio/list-picker
_43
var twilioListPicker = new TwilioListPicker.Builder();
_43
twilioListPicker.WithBody("Owl Air Flash Sale! Hurry! Sale ends on {{1}}!");
_43
var item1 = new ListPickerItems.Builder()
_43
.WithItem("SFO to NYC for $299")
_43
.WithDescription("Owl Air Flight 1337 to LGA")
_43
.WithId("SFO1337")
_43
.Build();
_43
var item2 = new ListPickerItems.Builder()
_43
.WithItem("OAK to Denver for $149")
_43
.WithDescription("Owl Air Flight 5280 to DEN")
_43
.WithId("OAK5280")
_43
.Build();
_43
var item3 = new ListPickerItems.Builder()
_43
.WithItem("LAX to Chicago for $199")
_43
.WithDescription("Owl Air Flight 96 to ORD")
_43
.WithId("LAX96")
_43
.Build();
_43
twilioListPicker.WithItems(new List<ListPickerItems>() { item1, item2, item3 });
_43
_43
// define all the content types to be part of the template
_43
var types = new Types.Builder();
_43
types.WithTwilioListPicker(twilioListPicker.Build());
_43
_43
// build the create request object
_43
var contentCreateRequest = new ContentCreateRequest.Builder();
_43
contentCreateRequest.WithTypes(types.Build());
_43
contentCreateRequest.WithLanguage("en");
_43
contentCreateRequest.WithFriendlyName("owl_sale_list");
_43
contentCreateRequest.WithVariables(new Dictionary<string, string>() { {"1", "end_date"} });
_43
_43
// create the twilio template
_43
var contentTemplate = await CreateAsync(contentCreateRequest.Build());
_43
_43
Console.WriteLine($"Created Twilio Content Template SID: {contentTemplate.Sid}");

Output

_42
{
_42
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"date_created": "2022-08-29T15:46:11Z",
_42
"date_updated": "2022-08-29T15:46:11Z",
_42
"friendly_name": "owl_air_list",
_42
"language": "en",
_42
"links": {
_42
"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",
_42
"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"
_42
},
_42
"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"types": {
_42
"twilio/list-picker": {
_42
"body": "Owl Air Flash Sale! Hurry! Sale ends on {{1}}!",
_42
"button": "Select a destination",
_42
"items": [
_42
{
_42
"description": "Owl Air Flight 1337 to LGA",
_42
"id": "SFO1337",
_42
"item": "SFO to NYC for $299"
_42
},
_42
{
_42
"description": "Owl Air Flight 5280 to DEN",
_42
"id": "OAK5280",
_42
"item": "OAK to Denver for $149"
_42
},
_42
{
_42
"description": "Owl Air Flight 96 to ORD",
_42
"id": "LAX96",
_42
"item": "LAX to Chicago for $199"
_42
}
_42
]
_42
},
_42
"twilio/text": {
_42
"body": "We have flights to the following destinations: (1) SFO, (2) OAK, (3) LAX. Hurry! Sale ends on {{1}}!"
_42
}
_42
},
_42
"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"variables": {
_42
"1": "end_date"
_42
}
_42
}


Rate this page: