# Use the Programmable Messaging API with Twilio Regions

You can use the Programmable Messaging API in Twilio's [Ireland (IE1) region](/docs/global-infrastructure/understanding-twilio-regions) for EU data residency.

For more information on how SMS personal data is processed when using this feature, see the overview of [EU Data Residency for SMS][eu-data-residency].

> \[!IMPORTANT]
>
> Data Residency for SMS in the EU is currently available as a Public Beta product and the information contained in this document is subject to change. This means that some features are not yet implemented and others may be changed before the product is declared as Generally Available. Public Beta products are not covered by the Twilio Support Terms or Twilio Service Level Agreement (SLA). Learn more about [beta product support](https://help.twilio.com/articles/115002413087-Twilio-Beta-product-support).

This guide explains how to configure your application to use the Programmable Messaging API with the IE1 Region. For a general overview of Twilio Regions, see [Understanding Twilio Regions](/docs/global-infrastructure/understanding-twilio-regions).
For information about the Messaging API, see [Programmable Messaging API Overview](/docs/messaging/api).

## Available features

With SMS in the IE1 region, you can use the Programmable Messaging API to send and receive SMS messages with [EU Data Residency][eu-data-residency]. This includes:

* Configuring the phone number to be used in IE1 using the [Phone Number Regional Configuration API][phone-number-region-api].
* Sending outbound SMS using alphanumeric sender IDs and phone numbers that have been enabled in the IE1 region.
  * Programmable Messaging API [Messages resource][messages-resource] to send and manage SMS messages.
  * [Messaging Services resource][services-resource] to manage messaging services and their senders.
* Inbound SMS processing with webhooks configured through either:
  * The [Incoming Phone Numbers resource][incoming-phone-number-resource].
  * [Messaging Services][services-resource] webhooks.

> \[!NOTE]
>
> Access to SMS in IE1 is API only. The Twilio Console does not support managing messaging resources in IE1, except for [creating IE1-specific API credentials][regional-credentials].
>
> For an in-depth list of available Messaging features in IE1, see [Messaging IE1 Feature Availability](/docs/global-infrastructure/messaging-eu-feature-availability).

## Getting started

Any Twilio customer can use the Programmable Messaging API in IE1. To get started, follow these steps:

### 1. Create IE1-specific API credentials

To authenticate requests to the IE1 Region, you must create region-specific API keys. See [Manage regional API credentials][regional-credentials] to get started.

### 2. Configure your senders for IE1

If you plan on sending with phone numbers, you must use the [Phone Number Regional Configuration API][phone-number-region-api] to update the phone number's region for messaging. This ensures that inbound messages and webhooks configured on the phone number are processed in IE1.

Alphanumeric sender IDs do not require additional configuration to be used in IE1, since they do not support inbound messaging.

### 3. Send messages in IE1 through the API or SDK

Once your credentials and senders are prepared, you can begin sending messages by targeting the IE1-specific base AP URLs or by configuring your SDK to use the IE1 region.
See the [API](#using-the-programmable-messaging-api-in-ie1) or [SDK](#using-the-twilio-sdks-with-ie1) sections for details and examples.

## Using the Programmable Messaging API in IE1

To make API requests to the IE1 Region, use the following base URLs:

| API Resource                                             | API URL for Ireland (IE1) Region                                                           |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [Messages][messages-resource]                            | `https://api.dublin.ie1.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/Messages/`             |
| [Messaging Services][services-resource]                  | `https://messaging.dublin.ie1.twilio.com/v1/Services`                                      |
| [Incoming Phone Numbers][incoming-phone-number-resource] | `https://api.dublin.ie1.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/IncomingPhoneNumbers/` |

> \[!NOTE]
>
> Only the `dublin` edge location is supported for messaging API requests in IE1.

### Configure a phone number for IE1

Using the [Phone Number Regional Configuration API][phone-number-region-api], you can update a phone number's configuration to enable it for use in the IE1 Region. This is required for any phone numbers to send messages through IE1.

> \[!NOTE]
>
> This is a US1 based configuration API that requires US1 API credentials.

```bash
curl -X POST "https://routes.twilio.com/v3/PhoneNumbers/+35XXXXXXXXXX" \
--data-urlencode "voiceRegion=ie1" \
--data-urlencode "messagingRegion=ie1" \
-u US1_API_KEY_SID:US1_API_KEY_SECRET
```

### Send an SMS message

To send an SMS message through the IE1 Region, make a `POST` request to the [Messages resource][messages-resource] using the IE1 base URL.

```bash
curl -X POST "https://api.dublin.ie1.twilio.com/2010-04-01/Accounts/*ACCOUNT_SID*/Messages.json" \
--data-urlencode "Body=Hello from IE1!" \
--data-urlencode "From=+35XXXXXXXXXX" \
--data-urlencode "To=+35XXXXXXXXXX" \
-u {IE1_API_KEY_SID}:{IE1_API_KEY_SECRET}
```

### Messaging Services in IE1

Messaging Services must be created in IE1 in order to be used for outbound and inbound messaging in IE1.
For a list of Messaging Service features currently supported in IE1, see [Messaging IE1 Feature Availability](/docs/global-infrastructure/messaging-eu-feature-availability#messaging-services).

To create a Messaging Service in the IE1 Region, make a `POST` request to the [Services resource][services-resource] using the IE1 base URL.

```bash
curl -X POST "https://messaging.dublin.ie1.twilio.com/v1/Services" \
--data-urlencode "FriendlyName=My IE1 Messaging Service" \
-u {IE1_API_KEY_SID}:{IE1_API_KEY_SECRET}
```

To add a Messaging Service sender in IE1, make a `POST` request to the appropriate subresource under the Messaging Service using the IE1 base URL.

> \[!NOTE]
>
> Only phone number senders that are configured for IE1 through the [Phone Number Regional Configuration API](/docs/global-infrastructure/inbound-processing-api#v3-region-configuration-api) can be added to Messaging Services in IE1.

```bash
curl -X POST "https://messaging.dublin.ie1.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers" \
--data-urlencode "PhoneNumber=+35XXXXXXXXXX" \
-u {IE1_API_KEY_SID}:{IE1_API_KEY_SECRET}
```

To send messages with the Messaging Service in IE1, include the Messaging Service SID as the `From` parameter in your API request:

```bash
curl -X POST "https://api.dublin.ie1.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json" \
--data-urlencode "Body=Hello from IE1 Messaging Service!" \
--data-urlencode "From={ServiceSid}" \
--data-urlencode "To=+35XXXXXXXXXX" \
-u {IE1_API_KEY_SID}:{IE1_API_KEY_SECRET}
```

### Configure inbound SMS webhooks

Inbound webhooks for messages received in IE1 can be configured through the [Incoming Phone Numbers resource][incoming-phone-number-resource] or through the [Messaging Services resource][services-resource].

Using the [Incoming Phone Numbers resource][incoming-phone-number-resource]:

```bash
curl -X POST "https://api.dublin.ie1.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{PhoneNumberSid}.json" \
--data-urlencode "SmsUrl=https://www.example.com/sms" \
--data-urlencode "SmsMethod=POST" \
-u {IE1_API_KEY_SID}:{IE1_API_KEY_SECRET}
```

Using the [Messaging Services resource][services-resource]:

```bash
curl -X POST "https://messaging.dublin.ie1.twilio.com/v1/Services/{ServiceSid}" \
--data-urlencode "InboundRequestUrl=https://www.example.com/sms" \
--data-urlencode "InboundMethod=POST" \
--data-urlendcode "useInboundWebhookOnNumber=false" \
-u {IE1_API_KEY_SID}:{IE1_API_KEY_SECRET}
```

## Using the Twilio SDKs with IE1

When using Twilio SDKs, specify the `edge` and `region` parameters to target the IE1 Region. For example, using the Node.js SDK:

```javascript
const twilio = require('twilio');

const ie1ApiKey = 'IE1_API_KEY';
const ie1ApiSecret = 'IE1_API_SECRET';

const client = twilio(ie1ApiKey, ie1ApiSecret, {
  accountSid: accountSid,
  edge: 'dublin',
  region: 'ie1'
});
```

[phone-number-region-api]: /docs/global-infrastructure/inbound-processing-api#v3-region-configuration-api

[messages-resource]: /docs/messaging/api/message-resource

[services-resource]: /docs/messaging/api/service-resource

[incoming-phone-number-resource]: /docs/messaging/api/phonenumber-resource

[eu-data-residency]: /docs/global-infrastructure/sms-eu-data-residency

[regional-credentials]: /docs/global-infrastructure/manage-regional-api-credentials
