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

twilio/location


Twilio/location type contains a location pin and an optional label, which can be used to enhance delivery notifications or connect recipients to physical experiences you offer.

(information)

Info

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

Location templates are not supported for approval on WhatsApp and can't be submitted for approval.


Supported Channels

supported-channels page anchor

WhatsApp


Content API - Location sample.

longitude:

  • Type: numbers
  • Required: yes
  • Variable Support: no
  • Description: The longitude value of the location pin you want to send. Value must be between [-90.0, +90.0]

latitude:

  • Type: numbers
  • Required: yes
  • Variable Support: no
  • Description: The latitude value of the location pin you want to send. Value must be between [-180.0, +180.0]

label:

  • Type: string
  • Required: no
  • Variable Support: yes
  • Description: Label to be displayed to the end user alongside the location pin.

Create Location Template

create-location-template page anchor
C#
Java
curl

_33
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
_33
_33
using System;
_33
using Twilio;
_33
using Twilio.Rest.Content.V1;
_33
_33
TwilioClient.Init(accountSid, authToken);
_33
_33
// define the twilio/text
_33
var twilioText = new TwilioText.Builder();
_33
twilioText.WithBody("Owl Air: Time to board, SFO is located at San Francisco International Airport, P.O. Box 8097, San Francisco, CA 94128 ");
_33
_33
// define the twilio/location
_33
var twilioLocation = new TwilioLocation.Builder();
_33
twilioLocation.WithLabel("Time to Board @ SFO");
_33
twilioLocaiton.WithLatitude(37.62159755922449)
_33
twilioLocaiton.WithLongitude(-122.37888566473057)
_33
_33
// define all the content types to be part of the template
_33
var types = new Types.Builder();
_33
types.WithTwilioText(twilioText.Build());
_33
types.WithTwilioLocation(twilioLocation.Build());
_33
_33
// build the create request object
_33
var contentCreateRequest = new ContentCreateRequest.Builder();
_33
contentCreateRequest.WithTypes(types.Build());
_33
contentCreateRequest.WithLanguage("en");
_33
contentCreateRequest.WithFriendlyName("owl_air_location");
_33
_33
// create the twilio template
_33
var contentTemplate = await CreateAsync(contentCreateRequest.Build());
_33
_33
Console.WriteLine($"Created Twilio Content Template SID: {contentTemplate.Sid}");

Output

_24
{
_24
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24
"date_created": "2022-08-29T15:23:12Z",
_24
"date_updated": "2022-08-29T15:23:12Z",
_24
"friendly_name": "owl_air_location",
_24
"language": "en",
_24
"links": {
_24
"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",
_24
"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"
_24
},
_24
"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24
"types": {
_24
"twilio/location": {
_24
"label": "Time to Board @ SFO",
_24
"latitude": 37.62159755922449,
_24
"longitude": -122.37888566473057
_24
},
_24
"twilio/text": {
_24
"body": "Owl Air: Time to board, SFO is located at San Francisco International Airport, P.O. Box 8097, San Francisco, CA 94128 "
_24
}
_24
},
_24
"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24
"variables": {}
_24
}


Rate this page: