The chat channel for Twilio Conversations is now available in our new Ireland (IE1) Region . Use the IE1 Region if you would like your application's chat data to be processed and stored in our Ireland data centers.
This guide will walk you through the changes you'll need to make to your application in order to use the IE1 Region.
If you're new to Twilio Conversations, please take a look at overview page and complete the Conversations API Quickstart before reading this guide. It's also helpful to be familiar with the fundamental concepts introduced in our guide to understanding Twilio Regions.
Before we get started, it's important to review the list of available Conversations channels and features, to make sure that your use case is supported in your target Twilio Region.
The following table shows the available channels per Region.
Chat | SMS | Facebook Messenger | ||
---|---|---|---|---|
US1 | ✅ | ✅ | ✅ | ✅ |
IE1 | ✅ | x | x | x |
AU1 | x | x | x | x |
Note the following Conversations features are currently unavailable in the IE1 region:
If your use case requires a channel or feature that isn't yet available in the IE1 or AU1 Regions, you'll need to use the US1 Region for now.
For a complete list of available Regions and Features, see the availability reference page.
At a high level, there are two main changes to an application required for it to use Conversations in IE1:
We'll take a step-by-step look at both in the following sections.
The Twilio Rest API operates on a per-Region basis. To control which Twilio Region is used for your conversations, you can specify a target Region for your API requests and SDK connections.
If you don't specify a target Region in the request, the request will be handled in the default US1 region.
To specify the target Region for an API request, include the name of the target Region and preferred Edge Location in the hostname of the request.
The target Region specifies the data center where your Conversations data will be processed and stored, while the Edge Location specifies the point where your servers or clients will connect to Twilio's networking infrastructure.
This walkthrough will use the target Region of IE1 with the dublin
Edge Location, though you may select to use any of Twilio's public Edge Locations based on the location of your application hosting infrastructure.
The following base URL for the Conversations API encodes these selections in the hostname:
https://conversations.dublin.ie1.twilio.com/v1
If you are using one of Twilio's server-side helper libraries to make API requests, you don't need to worry about constructing the hostname for your requests. Instead, you'll supply the client constructor with edge and region parameters, and the client will automatically construct the appropriate hostname accordingly.
See the examples below, or check out our guide on using the REST API with non-US1 Regions for more details.
Since each Twilio Region operates independently of other Regions, even API credentials such as API Keys are a Region-specific resource. This means that in order to authenticate your API requests against the IE1 Region, the requests need to use an API key that was created specifically for the IE1 region.
Create an API Key in IE1 by following the instructions inour guide to managing Regional API credentials.
Be sure to make a note of the API Key's SID and Secret . You will need this information for the next step.
To create your first Conversation with Twilio Regions, you'll need to make a POST
request to the Conversation endpoint. You can run the following command:
1curl -X POST \2-u $API_KEY_SID:$API_KEY_SECRET \3https://conversations.dublin.ie1.twilio.com/v1/Conversations \4--data-urlencode "FriendlyName=Conversations with Twilio Regions"
The response should be a JSON representation of the new Conversation. Note your conversation SID as you will need it for the following steps. You can optionally use any of Twilio's language-specific server-side helper libraries to make the API requests. For example, you can create a Conversation using the Node.js helper library, by passing the region attribute on the client instance, like this:
1const accountSid = process.env.ACCOUNT_SID;2const apiKeySid = process.env.API_KEY_SID;3const apiKeySecret = process.env.API_KEY_SECRET;45const client = require('twilio')(6apiKeySid,7apiKeySecret, {8accountSid: accountSid,9edge: 'dublin',10region: 'ie1'11});1213client.conversations.conversations14.create({15friendlyName: 'Conversations with Twilio Regions'16});
Now that we created a Conversation, you can add chat-based Conversations Participants. To have an interactive Conversation, let's add two chat Participants.
Make sure to replace CHXXX
with your Conversation SID for the Conversation you created in the step above.
Add the first chat Participant:
1curl -X POST \2-u $API_KEY_SID:$API_KEY_SECRET \3https://conversations.dublin.ie1.twilio.com/v1/Conversations/CHXXX/Participants \4--data-urlencode "Identity=Bob"
Add the second chat Participant:
1curl -X POST \2-u $API_KEY_SID:$API_KEY_SECRET \3https://conversations.dublin.ie1.twilio.com/v1/Conversations/CHXXX/Participants \4--data-urlencode "Identity=Alice"
To send the first Message in the Conversation, you can make a POST
request to the Conversation Message resource endpoint to create a new Message.
You can run the following command:
1curl -X POST \2-u $API_KEY_SID:$API_KEY_SECRET \3https://conversations.dublin.ie1.twilio.com/v1/Conversations/CHXXX/Messages \4--data-urlencode "Author=Bob" \5--data-urlencode "Body=Ahoy there"
Now, you can have the second chat Participant answer to the message:
1curl -X POST \2-u $API_KEY_SID:$API_KEY_SECRET \3https://conversations.dublin.ie1.twilio.com/v1/Conversations/CHXXX/Messages \4--data-urlencode "Author=Alice" \5--data-urlencode "Body=Hi,how are you?"
At this point, you've successfully created a Conversation with two chat Participants using a non-US1 Twilio Region. The Conversation record and its related data (Participants, Messages) will only exist in the IE1 Region and will not be accessible in any other Twilio Regions.
To manage your IE1-based Conversations resources in the Twilio Console, you'll first need to "pin" the Conversations product to the navigation menu for IE1.
Click the Explore Products link at the bottom of the left-hand navigation menu. Find Conversations in the product list under the Programmable Communications section, and click the arrow symbol next to the pin icon. Now click on Ireland (IE1) to pin the product for that Region.
You will now find an expandable section of the left-hand navigation menu labeled Ireland (IE1) . Selecting items from this section of the menu will show the resources specific to the IE1 Region.
Navigate to Ireland (IE1) -> Conversations -> Manage -> Services and click on the Default Conversations Service link to find the Conversations you created in IE1 during the previous steps.
See this guide to learn more about managing IE1-based resources in Twilio Console.
In order to seamlessly interact with Twilio Conversations via the chat channel from mobile or web applications, you'll use one of the Conversations mobile or web SDKs.
SDK clients connect to the US1 Region by default. To connect a client to the IE1 Region instead, you can supply a region parameter to the client constructor.
When an SDK client connects to a given Region, it authenticates using the API credentials that are encoded in the JWT Access Token. The credentials used in the token must exist in the same Region that the client is connecting to, otherwise an authentication failure will occur.
The following examples show how to supply the region
parameter for each SDK.
1const conversationsClient = await ConversationsClient.create(2accessToken,3{ region: "ie1" }4);5
Now that you know the basics of using Conversations with the Twilio IE1 Region, you're ready to migrate your own applications.
Twilio cannot migrate your application to another Region on your behalf. Instead, you need to make some adjustments to your application's configuration in order to change the Twilio Region that it integrates with.
If you have a Conversations-powered app up and running already using Twilio's original US1 Region, you can follow these steps to migrate the application to the IE1 Region.
Note that your application will no longer have access to any existing Conversations resources (e.g. Messages, Participants, etc) that had been previously created in US1.