Mmmsservice Would Like to Sent a Message to 21101 Are You Sure You Want to Continue
Messaging Services
Sending a high volume of messages in the United States and globally quickly becomes complex. As the complexity of your messaging application grows, it's helpful to organize your account and message logs into separate Messaging Services using Twilio Programmable Messaging.
You can think of a Messaging Service as a higher-level "bundling" of messaging functionality around a common set of senders, features, and configuration. The same settings and feature configuration applies to all of the senders (long code numbers, short codes, toll-free numbers, etc.) in the Messaging Service's pool.
A Messaging Service's features can be managed and configured directly through the Console as well as using the REST API.
With each Messaging Service that you add through the console, you'll start by configuring both the Inbound Request
and Status Callback URLs
. You'll also need to associate one or more phone numbers or short codes to the Service to send messages. You can add additional messaging features (described below) to your application through your newly configured messaging service.
Send a message with a Messaging Service
If you use a messaging service to send a message, your request to Twilio will look very similar to sending an SMS with the REST API. However, instead of including a From
phone number, you'll include a MessagingServiceSid
. Twilio will then choose one of the phone numbers in your Messaging Service's sender pool based on your service's configuration.
When sending a message with a messaging service, Twilio will immediately set the message's status to accepted
. Twilio will then determine the optimal From
phone number from your service. Any delivery errors will be sent asynchronously to your StatusCallbackURL.
Using WhatsApp with Messaging Services
You can add a WhatsApp-enabled Twilio phone number to the other sender-types (long codes, short codes, etc.) in your Messaging Service Sender Pool. This way, you can configure and apply the relevant Messaging Service features, such as setting a Validity Period, for all sender types in one Service all at once. In the feature descriptions below, we include whether the feature is supported for both SMS and WhatsApp.
To include WhatsApp in your Sender Pool, in the Twilio Console, navigate to the Messaging > Services section and select a Messaging Service. Under that Service's Sender Pool, you can Add Senders and specify the WhatsApp-enabled Twilio number that you wish to include.
For more information about configuring the WhatsApp Business API with Twilio, please read Connect your Twilio Number to your WhatsApp Business Profile.
"Out-of-the-box" Messaging Service features
Messaging Services are designed to help you scale your application's messaging from your first SMS to messages sent globally, in multiple languages, from more than just long code phone numbers.
As soon as you create your Messaging Service, the following features apply automatically.
Alpha Sender
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
Alphanumeric Sender IDs are used for branded one-way messaging. You can add an Alphanumeric Sender ID to your Sender Pool to enable this feature.
With Alpha Sender, you can send your messages to customers from a customized sender. Instead of using an E.164-formatted Twilio phone number for the From
value, you can use a custom string like your own business' branding. Alphanumeric Sender IDs may be used at no additional cost when sending an SMS to countries that support this feature.
If you add an Alpha Sender to your Twilio Messaging Service, Twilio will select the Alphanumeric Sender ID automatically when you send a message to a supported country, unless you also have a short code number in that same country.
To add an Alphanumeric Sender ID to a Messaging Service, go to your Messaging Services in the Twilio console. Select the service you wish to add an Alpha Sender to, and under the Senders section, click the Add Senders IDs button. From the following drop-down, select Alpha Sender and enter the alphanumeric sender ID that you want to add to the Sender Pool.
To learn more about Alphanumeric Sender IDs, see the support article on getting started with Alphanumeric Sender ID.
Short Code Reroute
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
When your Messaging Service Sender Pool includes a short code, Twilio always prioritizes message delivery using that short code. If a carrier is not supported by a Twilio short code, Twilio automatically delivers the message with a long code in your Messaging Service instead.
Twilio automatically applies short code rerouting for messages sent through your Messaging Service. This is not a feature that you enable or disable.
Short code reroute does not attempt to redeliver your message over a long code due to a Failed
or Undelivered
delivery status. For this functionality, read about the Fallback to Long Code feature.
Country Code Geomatch
Supported for SMS? | Supported for WhatsApp? |
Yes | Yes |
When sending messages internationally, the Country Geomatch feature automatically selects the Twilio phone number in your Messaging Service to match the country of your recipient's phone number. If your Service does not include a Twilio phone number for the same country of the recipient, Twilio first attempts to select an SMS-enabled US phone number before selecting another phone number to deliver your message. Your message will fail if there are no phone numbers available in your Service to deliver your message.
You can use Country Code Geomatch by adding phone numbers to your Messaging Service that match the countries of your recipients.
When a phone number of a new geographic country is added to your Messaging Service, Twilio automatically selects and remaps any existing Sticky Sender mappings so that the From
number matches the same country as your recipient's phone number.
Scaler
Supported for SMS? | Supported for WhatsApp? |
Yes | Yes |
The Scaler feature distributes your outbound messaging traffic evenly across the phone numbers in your Messaging Service so that you can handle higher volumes of messages. When your Messaging Service sends a message, it selects the From
number from your pool of numbers that are not currently being used to send other messages.
When Sticky Sender is enabled, the Messaging Service prioritizes any existing Sticky Sender mappings first. It then selects the next available phone number from your Service's Sender Pool which has the fewest number of mappings.
More than one toll-free number should not be included within the same Messaging Service's Sender Pool. This can result in blocking that number.
Configurable Messaging Services features
In addition to the basic Messaging Service functionality discussed above, there are several, more advanced features that you can use to manage your Service's senders, integration with your application, your messaging content, compliance, opt-out keywords, and more.
You can enabling these features and change their settings in the Twilio Console.
Sticky Sender
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
The Sticky Sender feature ensures the same From
phone number is selected every time your application sends a message to a particular end-user. This allows your application to consistently send messages to your user from a single, recognizable phone number.
With Sticky Sender enabled, Twilio maintains a mapping of all To
and From
phone numbers that your Messaging Service has used and interacted with. Twilio creates a new mapping after it sends the first message from your Messaging Service to a particular end-user. All future messages sent to that recipient from the Service will also use the same From
number.
If Sticky Sender is turned off, your Messaging Service ignores all previously established mappings. However, if you toggle Sticky Sender back on in the future, your Messaging Service will retain and reference the previously existing mappings.
When a Twilio phone number is removed from your Messaging Service, Twilio deletes all Sticky Sender mappings associated wth the removed Twilio number.
How to enable Sticky Sender
Under the Sender Pool section of your Messaging Service, expand the Sender Selection Settings box. From there, you can enable or disable the Sticky Sender feature.
Intelligent number selection within a Messaging Service
When Sticky Sender is enabled, the Messaging Service follows the logic below to determine the optimal phone number as the from
number:
Area Code Geomatch
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
When sending messages to the United States and Canada, the Area Code Geomatch feature selects a local phone number with an area code that either matches or is an overlay of your end-user's number.
If an overlay or matching area code is not available, the Messaging Service will select another US or Canadian phone number from your Messaging Service. Geographic proximity is not taken into consideration when selecting a phone number.
How to enable Area Code Geomatch
Under the Senders section of your Messaging Service, expand the Sender Selection Settings box. From there, you can enable or disable the Area Code Geomatch feature.
This feature is not available outside the the US and Canada.
Fallback to Long Code
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
The Fallback to Long Code feature re-attempts message delivery using a long code phone number when certain messages that were sent with a short code are not successfully delivered.
When sending a message, your Messaging Service prioritizes message delivery with a short code if one is available. However, the short code message may have an undelivered
status if the end-user is unable to receive short code messages. In this case, your Messaging Service re-attempts sending the message using a long code phone number from your Service's Sender Pool.
Please note that not all undelivered
messages are re-sent using a long code phone number. Successful message delivery via the long code is also not guaranteed.
You will be charged for both the short code message and the second message attempted over a long code phone number.
You should only enable Fallback to Long Code if your end-users have opted in to receiving SMS messages from you. All carrier compliance requirements and industry standards must be followed.
How to enable Fallback to Long Code
Under the Senders section of your Messaging Service, expand the Sender Selection Settings box. From there, you can enable or disable the Fallback to Long Code feature.
Validity Period
Supported for SMS? | Supported for WhatsApp? |
Yes | Yes |
Validity Period refers to the number of seconds that messages sent from your Messaging Service will remain in Twilio's platform. If sending the message exceeds the Validity Period, Twilio fails the message and sends a request to your status callback URL to notify your application of the failure.
Twilio's Validity Period applies only to messages while they travel through the Twilio platform. After Twilio sends the messages to the carrier network, the carriers may still queue the messages, resulting in a send time that exceeds the Validity Period.
How to enable Validity Period
Under the Integration section of your Messaging Service, you can enter the maximum queue time — in seconds — in the Validity period box.
You can set the Validity Period between 1 and 14,440 seconds (a maximum of four hours).
Incoming Messages Handling
Supported for SMS? | Supported for WhatsApp? |
Yes | Yes |
By default, Messaging Services are set to Drop Incoming Messages. If you want to take actions on every message, you can set it to send a webhook any time you receive an incoming message through a number in your Messaging Service's number pool. You can also change the behavior to automatically create a new Conversation — there's more on this feature under Inbound Message Handling & Autocreation in Conversations.
How to enable Incoming Messages Handling
Under the Integration section of your Messaging Service, you can update how your messaging service handles incoming messages. Please be aware that using the Create new Conversation option requires additional configuration changes under the Conversations section of the Twilio Console.
Smart Encoding
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
Your Messaging Service's Smart Encoding feature detects easy-to-miss Unicode characters and replaces them with a similar GSM-encoded character. This helps ensure that your message gets segmented at 160 characters and saves you from sending two message segments, which increases your spend.
For example, sometimes a Unicode character such as a smart quote ( 〞), a long dash (—), or a Unicode whitespace accidentally slips into your carefully crafted 125-character message. Now, your message is segmented and priced at two messages instead of one.
When Unicode characters are used in an SMS message, they must be encoded as UCS-2. However, UCS-2 characters take 16 bits to encode, so when a message includes a Unicode character, it will be split or segmented between the 70th and 71st characters. This is shorer than the 160-character per message segment that you get with GSM-7 character encoding.
How to enable Smart Encoding
Under the Content Settings section of your Messaging Service, you can enable or disable the Smart Encoding feature for SMS messages.
MMS Converter
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
The MMS Converter feature automatically delivers your MMS message as an SMS text message. This SMS (text) message contains a shortened URL linking to your image when the carrier is not supported to receive Twilio MMS Messages. MMS Converter appends the shortened URL link (http://m.twil.io/
followed by seven unique characters) to the end of the message body; this link remains active for 365 days (one year).
Twilio bills the converted messages as SMS Messages. The appended URL may cause the body of the text message to be greater than the number of characters-per-segment for the character encoding system (read about GSM-7 and UCS-2). In this case, Twilio segments the message and bills accordingly.
How to enable MMS Converter
You can enable or disable the MMS Converter feature under the Content Settings section of your Messaging Service.
MMS Converter sends links to media files via SMS where the receiving carrier does not support MMS. It does not enable you to send media if your From
phone number lacks MMS capabilities.
You can check the capabilities of numbers in the console or query the Available Phone Numbers resource to search for Twilio numbers that are MMS enabled.
Sender ID Pre-registration Alert
Supported for SMS? | Supported for WhatsApp? |
Yes | No |
The Sender ID Pre-registration Alert feature automatically alerts you when you send messages to countries that require pre-registered Sender IDs. Some countries that support Alphanumeric Sender IDs require pre-registration of the Sender ID prior to use.
To help you remain compliant, enable Sender ID Pre-registration Alert as you scale your messaging traffic. Once it is enabled, this feature issues warnings when you send unregistered messaging traffic in countries where registration is recommended or required. You can find the alerts in the Debugger section of the Twilio Console.
While this feature does alert you of a potential compliance issue, it does not block or prevent your messages from being sent.
How to enable the Sender ID pre-registration alert
You can enable or disable the Sender ID pre-registration alert feature under the Compliance section of your Messaging Service.
Advanced Opt-Out
Supported for SMS? | Supported for WhatsApp? |
Yes | Yes |
The Advanced Opt-Out feature gives you the ability to deliver a customized, end-to-end compliance experience for your users. You have the ability to set the opt-in, opt-out, and help keywords and confirmation messages on a global basis as well as add per-language and per-country overrides. For example, you can customize the message that your end-users receive if they reply with "STOP" in English or with "AYUDA" in Spanish.
In addition, Advanced Opt-Out gives you deeper insight into your campaign performance and user engagement with your Messaging Service. When a user triggers one of your opt-in, opt-out, or help keywords, Twilio includes the OptOutType
in its request to your configured webhook URL so that you can keep track of the health of your campaigns.
How to enable Advanced Opt-Out
Under the Opt-Out Management section of your Messaging Service, you can enable Advanced Opt-Out as well as customize all of the keyword and confirmation messages for opt-out, opt-in, and help interactions with your end users.
We recommend that you read the guide to customizing users' opt-in and opt-out experience with Advanced Opt-Out to ensure that you configure this feature properly for your messaging needs.
Link Shortening & Click Tracking
Link Shortening is currently in Public Beta. Link Shortening with click tracking functionality is free for users during our Public Beta. For more information, please reference Twilio Terms of Service.
To create a message with shortened links via Twilio Messaging API, navigate here.
Overview
Link Shortening is a feature under Twilio Messaging Services that enables you to shorten links in your communications, with your company branded registered domain, and track engagement across SMS, MMS, and WhatsApp. Link Shortening features are embedded into Twilio Messaging API so that there is minimal implementation change required.
Link Shortening example:
Original Message Body | Delivered Message Body |
Please visit this link to get started and start earning your rewards today! | Please visit this link to get started and start earning your rewards today! |
You can make a request to Twilio Messaging API with original long links in the message body as shown above. You will just need to attach Link Shortening parameters to your requests and Twilio Link Shortening will dynamically shorten the links. | Twilio Link Shortening detects the long links in the message body and shortens it with a unique short link. Short links will be your registered domain followed by 10 alphanumeric characters as shown in the example above. |
Bring Your Own Domain
Link Shortening will require you to register and use your own domain for the shortened links. Unlike third party link shortening solutions, you will not need to share a domain with other customers and you will be able to brand the shortened links to your own business.
Shortened Links Retention
We will store the original link and shortened link associations for ninety days. When a recipient clicks on the URL in the message within the first ninety days, they will be redirected to the original link. Ninety days after the message is delivered, a click will redirect to a fallback URL, which can be set up in default preferences via console or the Domain Config API. A fallback URL can be set per domain.
Account Based Rate Limits
Twilio will not deliver your messages if you exceed the rate limit for Link Shortening. However, if Link Shortening service is in an outage, messages will be delivered with original links in the message body as Twilio considers deliverability as top priority. This may result in multiple message segments if the message body with the original link exceeds the character limit, resulting in extra messaging cost.
Link Shortening has an account based rate limit of ten requests per second for links shortened. This means that you can send requests to the Messaging API with link shortening enabled at ten requests per second rate limit. If you exceed the rate limit, you will receive a 20429
error code and we will not shorten the links and the messages will not be delivered to the recipients.
Click Tracking
Twilio Messaging allows you to set a custom retention period for your message records in Twilio. Default is set to 400 days
but you can configure this to be at minimum 7 days
. If you are setting custom retention periods for your message records that are less than ninety days, we won't be able to generate link clicked events as the message records will no longer be stored within Twilio. If you wish to receive link clicked events while the shortened link is valid, please set the retention period of your message records to be at least ninety days.
Unique Shortened Links
Different from other standalone link shortening solutions, each link that we shorten will get a unique ten alphanumeric character slug ID. This enables us to track engagement data per link, message, and recipient. Even when the shortened links expire after ninety days, the ten character slugs that have been previously used will never be recycled.
Click Events to Your Webhooks
You will also be able to set up callback URLs (webhooks) to receive a click event that is generated whenever a recipient clicks on a shortened link via the Domain Config API. Each click event will contain information such as the number the message was sent to, the original link contained in the message, and the time the recipient clicked on the link. If the recipient clicks on the link multiple times, multiple events will be generated.
Please Note: After the association between the original link and the shortened link expires (90 days), we will no longer generate link clicked events for the expired shortened links.
Click event example:
{ "event_type": "click", "sms_sid": "SMxxx", "to": "+11234567890", "from": "+10987654321", "link": "https://www.longlink.com/original_link", "clicked_at": 1659130287681 "messaging_service_sid": "MGxxx", "account_sid": "ACxxx", "user_agent": "some_user_agent" }
Getting Started
To get started with Link Shortening & Click Tracking, navigate to Messaging > Services and select the Messaging Service you want to use. In the left navigation pane, click on Link Shortening.
You can also get started via our Domain Certificate and Domain Config API as shown below:
Step 1: Setting up an Organization
Link Shortening requires you to set up an Organization in the Twilio Admin Center. This can be accessed and set up via the console. More information regarding Organization can be found here.
Step 2: Registering Domains
After setting up your Organization, you can now register and verify domains within the Organization. You will need to already own the domains you wish to register and will need to be able to update your DNS configurations or upload an HTML page file to your website's root directory to verify the domains. Link Shortening can only be used with verified domains. More information regarding domains in Organization can be found here.
Step 3: Adding DNS Records
Domain Name System (DNS) records are configurable records for your domain that contains information such as what IP addresses are associated with the domain and how to handle requests to that domain.
Root domain is the highest hierarchical level in the domain (e.g. twilio.com). Subdomains are at levels lower than your root domain (e.g. abc.twilio.com, def.twilio.com, ghi.twilio.com).
Domains or subdomains set up for Link Shortening purposes have to be exclusive for Twilio Link Shortening only and the DNS records must reflect the following. If you want to onboard a root domain, you will need to point the A record of the domain to these 3 IPs and these IPs only. If other IPs are included, we will not be able to redirect to the destination URL.
- 3.233.187.46
- 3.233.108.250
- 54.157.2.211
If you are onboarding a subdomain, you will need to point the CNAME record of the subdomain to the following:
- lsct.ashburn.us1.twilio.com
Step 4: Generating TLS Certificate
The TLS certificate and private key must be generated in a PEM format (for the specific subdomain if relevant).
We only support private keys that start with BEGIN PRIVATE KEY or PKCS #8 formatted keys.
We do not support Subject Alternative Names in TLS Certificates.
You must generate a TLS certificate and private key to prove ownership of the domain you intend to use. Twilio requires that all redirects be served over HTTPS. Since Twilio will serve the redirects for a domain that you own, you'll need to provide TLS certificates to Twilio, so that a trusted connection can be set up with the requesting clients (consumers' browsers) and Twilio's servers on your behalf.
Please follow the steps below to upload your certificate. Most domain hosting services offer managed certificate solutions. There are paid options with annual subscriptions and free options such as letsencrypt.org (with the caveat that most free options only provide an expiration of up to 3 months).
Please note: It is your responsibility to track certificate expiration dates and re-upload to continue using the Link Shortening feature. Without a valid TLS certificate for a domain, Link Shortening will cease to work and your messages will be delivered with original long links that may result in multiple message segments and broken links. You can set up alerts with email notifications to get notified when your TLS certificate is about to expire with Twilio Alarms and the error code, 30131.
Step 5: Uploading TLS Certificate
Once your private key is verified, use your DomainSid
to upload your TLS certificate and private key.
The following is an example about the correct formatting for the TLS certificate and private key:
-----BEGIN CERTIFICATE----- 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 -----END CERTIFICATE----- -----BEGIN PRIVATE KEY----- 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 -----END PRIVATE KEY-----
Sample Request:
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Certificate \ --data-urlencode "TlsCert=$tlsCert" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Step 6: Configuring Fallback and Callback URLs
After you have uploaded a TLS certificate along with the private key for the domain you wish to use, you can now set default configurations for the domain and assign the configuration to Messaging Services. Following are the fields included in the Domain Config API. After you set default configurations for the domain, Twilio will automatically apply the default domain, fallback URL, and callback URL whenever you send a message with long links through the associated Messaging Service.
Field | Required | Description |
Domain | Yes | Domain you wish to use when shortening long links. You will need to register, verify, and upload a TLS certificate for the domain during onboarding. |
Messaging Service SIDs | Yes | Messaging Service SID you wish to associate the domain config to. |
Messaging Service SIDs Action | - | Required field if you are trying to update Messaging Service SIDs associated with the Domain Config. Available actions are 'add', 'delete', 'replace' (case-insensitive). 'add' option will append the Messaging Service SID to the existing list of Messaging Service SIDs; 'delete' will remove the Messaging Service SID from the existing list; 'replace' will replace the entire list of Messaging Service SIDs with the new set of Messaging Service SIDs. |
Fallback URL | No | Shortened links will expire after 90 days and we will no longer redirect recipients to the original long link. We will redirect the recipients to the fallback URL after the shortened links are expired. |
Callback URL | No | If you wish to receive click events to your webhook whenever the recipients click on the shortened links, you can set a callback URL. |
Setting default configurations for a domain
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config \ --data-urlencode "MessagingServiceSids=$MESSAGING_SERVICE_SID" \ --data-urlencode "MessagingServiceSidsAction=add" \ --data-urlencode "FallbackUrl=https://www.yourbusinessdomain.com" \ --data-urlencode "CallbackUrl=https://webhook.yourbusinessdomain.com/click_events" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Setting default configurations for a domain for multiple Messaging Services
Domain configuration can be associated with multiple Messaging Services so that the same domain, callback URL, and fallback URL are applied. In order to associate a domain configuration with multiple Messaging Services, please include all of the Messaging Service SIDs
in the request as shown below:
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config \ --data-urlencode "MessagingServiceSids=$MESSAGING_SERVICE_SID1" \ --data-urlencode "MessagingServiceSids=$MESSAGING_SERVICE_SID2" \ --data-urlencode "MessagingServiceSidsAction=add" \ --data-urlencode "FallbackUrl=https://www.yourbusinessdomain.com" \ --data-urlencode "CallbackUrl=https://webhook.yourbusinessdomain.com/click_events" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Disabling Link Shortening for a Message Service
You can dissociate the Messaging Service you want to disable for Link Shortening from the domain configuration by using the MessagingServiceSidsAction of delete
as shown below:
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config \ --data-urlencode "MessagingServiceSids=$MESSAGING_SERVICE_SID1" \ --data-urlencode "MessagingServiceSidsAction=delete" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Updating Callback URL and Fallback URL to existing Domain Configuration
You can always update callback URL and fallback URL for a particular domain configuration. In those cases, you can omit Messaging Service SIDs and Messaging Service SID action parameters.
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config \ --data-urlencode "FallbackUrl=https://www.yourbusinessdomain.com" \ --data-urlencode "CallbackUrl=https://webhook.yourbusinessdomain.com/click_events" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Link Clicked Event Payload response
{ "event_type": "click", "sms_sid": "SMxxx", "to": "+11234567890", "from": "+10987654321", "link": "https://www.longlink.com/original_link", "clicked_at": 1659130287681 "messaging_service_sid": "MGxxx", "account_sid": "ACxxx", "user_agent": "some_user_agent" }
Domain Certificate API
Domain Certificate API is to help you manage your domain certificates for Link Shortening. You will only need to upload the certificate once from one account as the Domain resource resides under Organization. Once a domain has a valid TLS certificate and private key uploaded, that domain can be used for Link Shortening in all accounts under the same Organization without needing to upload the certificate again.
https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Certificate
POST
Request (required parameter: TlsCert
):
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Certificate \ --data-urlencode "TlsCert=$TLS_CERT_AND_PRIVATE_KEY" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Response (201 Created):
{ "certificate_sid": "CWxxx", "date_expires":"2020-09-23T19:46:26Z", "domain_sid": "DNxxx", "domain_name": "domain_name", "date_updated": "2020-08-27T04:44:08Z", "date_created": "2020-08-27T04:44:08Z", "url": "https://messaging.twilio.com/v1/LinkShortening/Domains/DNxxx/Certificate" }
GET
Request:
curl -X GET https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Certificate \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Response (200 OK):
{ "certificate_sid": "CWxxx", "date_expires": "2020-09-23T19:46:26Z", "domain_sid": "DNxxx", "domain_name": "domain_name", "date_created": "2020-08-27T04:36:56Z", "date_updated": "2020-08-27T04:36:56Z", "url": "https://messaging.twilio.com/v1/LinkShortening/Domains/DNxxx/Certificate" }
Domain Config API
You will need to configure the domain, callback URL, and fallback URL you wish to use for a particular Messaging Service. Callback URL and fallback URL are set per domain, which means that if you wish to use the same domain in multiple Messaging Services, the same callback URL and fallback URL will be used.
You can see an example below:
Messaging Service 1
- Domain: my.biz
- Callback URL: https://webhook.biz.com/click-tracking
- Fallback URL: https://www.my-biz.com
Messaging Service 2
- Domain: my.biz
- Callback URL: https://webhook.biz.com/click-tracking
- Fallback URL: https://www.my-biz.com
Messaging Service 3
- Domain: other.biz
- Callback URL: https://webhook.otherbiz.com/events
- Fallback URL: https://www.my-other-biz.com
After you have set default preferences for a Messaging Service, you will need to specify the MessagingServiceSID in your Twilio Messaging API request so that we can apply the default preferences.
Field | Required | Description |
Domain | Yes | Domain you wish to use when shortening long links. You will need to register, verify, and upload a TLS certificate for the domain during onboarding. |
Messaging Service SIDs | Yes | Messaging Service SID you wish to associate the domain config to. |
Messaging Service SIDs Action | - | Required field if you are trying to update Messaging Service SIDs associated with the Domain Config. Available actions are 'add', 'delete', 'replace' (case-insensitive). 'add' option will append the Messaging Service SID to the existing list of Messaging Service SIDs; 'delete' will remove the Messaging Service SID from the existing list; 'replace' will replace the entire list of Messaging Service SIDs with the new set of Messaging Service SIDs. |
Fallback URL | No | Shortened links will expire after 90 days and we will no longer redirect recipients to the original long link. We will redirect the recipients to the fallback URL after the shortened links are expired. |
Callback URL | No | If you wish to receive click events to your webhook whenever the recipients click on the shortened links, you can set a callback URL. |
https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config
POST
Request (required parameter: MessagingServiceSid
and MessagingServiceSidsAction
):
curl -X POST https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config \ --data-urlencode "MessagingServiceSids=$MESSAGING_SERVICE_SID" \ --data-urlencode "MessagingServiceSidsAction=$MESSAGING_SERVICE_SIDS_ACTION" \ --data-urlencode "FallbackUrl=$FALLBACK_URL" \ --data-urlencode "CallbackUrl=$CALLBACK_URL" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Response (200 OK):
{ "config_sid": "ZKXXXX", "messaging_service_sids": $MESSAGING_SERVICE_SID, "fallback_url": "https://www.example.com", "callback_url": "https://www.example.com/webhook", "date_created": "2020-08-27T04:36:56Z", "date_updated": "2020-08-27T04:36:56Z" }
GET
Request:
curl -X GET https://messaging.twilio.com/v1/LinkShortening/Domains/$DOMAIN_SID/Config \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Response (200 OK):
{ "config_sid": "ZKXXXX", "messaging_service_sids": [$MESSAGING_SERVICE_SIDS], "fallback_url": "https://www.example.com", "callback_url": "https://www.example.com/webhook", "date_created": "2020-08-27T04:36:56Z", "date_updated": "2020-08-27T04:36:56Z" }
Source: https://www.twilio.com/docs/messaging/services
0 Response to "Mmmsservice Would Like to Sent a Message to 21101 Are You Sure You Want to Continue"
Post a Comment