# Twilio

{% hint style="info" %}
The **HTTP API datasource** will be used to connect to Twilio API.
{% endhint %}

## Configuration

### Prerequisites

Before connecting the data source, you'll need to obtain the necessary parameters for authentication.

Twilio supports [HTTP Basic Authentication](https://docs.uibakery.io/reference/http/api-authentication#basic-auth). For this type of authentication, you'll need your **Twilio account SID** as the username and your **auth token** as the password. You can find these credentials in the [Twilio console](https://www.twilio.com/login?g=%2Fconsole%3F\&t=2b1c98334b25c1a785ef15b6556396290e3c704a9b57fc40687cbccd79c46a8c).

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FzHJ0t7n4soIR25bcjIWZ%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-787dcd4a085ceba7e6c880274fa4f2d031c021f0_CleanShot%202023-05-17%20at%2012.52.54%402x-min.png?alt=media&#x26;token=69d4f6e4-0d93-414d-8112-e96cb4395807" alt=""><figcaption></figcaption></figure>

If you want to use [API keys](https://www.twilio.com/docs/usage/api/keys) to authenticate instead of your Twilio account SID and auth token, then you can use the **API key** as the username and your **API key’s secret** as the password. \
You can learn more about Twilio authentication in their [documentation](https://www.twilio.com/docs/usage/api#authenticate-with-http).

### Connecting the data source

Once you have the credentials, you can proceed to connecting your Twilio data source:

1. On the **Data sources** page, click **Connect**, and select *HTTP API* in the Data sources list.
2. Next, specify the **Base URL** - `https://api.twilio.com/api_version`.
3. Select **Basic Auth** in the *Authentication settings* dropdown and specify your account SID & auth token/API key & API key secret in the *Username* and *Password* fields respectively.
4. Finally, click **Connect Datasource** to complete the setup.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FNHFfoeRsCrnRMl23i4Xc%2FCleanShot%202025-04-18%20at%2015.52.13%402x-min.png?alt=media&#x26;token=27c38ca4-c33a-48c4-9bd7-3d93294a1464" alt=""><figcaption></figcaption></figure>

## Usage

Once you've established the connection between UI Bakery and your Twilio API, you can start interacting with its data. For this purpose, you'll need to use the [HTTP Request](https://docs.uibakery.io/reference/working-with-actions/http-request) action step.

Refer to [Twilio documentation](https://www.twilio.com/docs/messaging/api/message-resource) to learn more about Twilio requests.

{% hint style="info" %}
If you want to send messages in *trial* mode, you must first [verify your 'To' phone number with Twilio](https://support.twilio.com/hc/en-us/articles/223135427-What-s-the-difference-between-a-verified-phone-number-and-a-Twilio-phone-number-). You can verify it by adding the number to your [Verified Caller IDs](https://www.twilio.com/console/phone-numbers/verified) in the console.
{% endhint %}
