# Twilio

![Image 1 of 1](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565573372429.svg)
Twilio is a web-based customer engagement platform that allows software developers to semi-automatically build business communication processes that lets you make, take, and modify calls from any device; seamlessly embed PSTN, SIP, or VoIP calling into any app, site, or other services. It also automates user verification and marketing campaign monitoring using its web service APIs.

Relyance AI provides two (2) options to integrate with a tenant’s Twilio account.

1. [The first option uses an **Account SID** and **Auth Token**.](https://support.relyance.ai/hc/en-us/articles/6658136141581-Twilio#h_01G1S16SMFR0A5GF5NX47DKXTG)
2. [The second option uses an **API Key** and **API Secret**.](https://support.relyance.ai/hc/en-us/articles/6658136141581-Twilio#h_01G4WQ03FS395VZ222Y6A3QEVR)

#### Option 1 - Create an Account SID and Auth Token

---

In order to integrate Twilio with Relyance AI you will need an **Account SID** and **Auth Token**.

#### In Twilio:

![Twilio-5.png](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565956853645.png)
1. Login to your Twilio account.
2. Find the Auth Token in the Account Info pane of the Console Dashboard page.

![Twilio-1.png](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565558922509.png)

3. Copy the **Account SID** and **Auth Token** to enter in the Relyance app.

#### In the Relyance AI application:

![Screenshot](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565558924557.png)

![Screenshot](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565573374733.png)
![Screenshot](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565573378829.png)
![Screenshot](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565956854541.png)
![Screenshot](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565558929805.png)
![Screenshot](https://assets.relyanceuat.xyz/images/docs/34565573387789/34565573382157.png)

The **Authentication** step asks for:

- Using **Custom** —
    - **Account SID**: required; held as a secret.
    - **Auth Token**: required; held as a secret.
- Using **API Key** —
    - **API Key**: required; held as a secret.
    - **API Secret**: required; held as a secret.
#### Option 2 - Create an API Key and API Secret

---

In order to integrate Twilio with Relyance AI you will need an **API Key** and **API Secret**.

**Important limitation**: When using an API key you can only integrate with the account that the API Key belongs to. For a more exhaustive integration, use an Auth token.

To further restrict access, you can use a restricted Twilio API key (BETA) described here

. You will need to enable '

List

' access for the following permissions:

- Voice.Calls.calls
- Voice.Recordings.recordings
- Voice.outgoing-caller-ids
- Iam.accounts
- Messaging.messages
- Phone-numbers.active-numbers

Note that the **Address** endpoint cannot be accessed using a restricted API key.

#### In Twilio:

#### In the Relyance AI application:

<!-- failure-modes:begin (generated from the integration catalog; do not hand-edit) -->

## If the connection reports Connected but returns nothing

These are the ways this integration comes back empty without reporting an error. Generated from the integration catalog, so it tracks what the connection actually asks for.

1. **A feature you enabled returns nothing.** Some scopes belong to a feature rather than to the connection: **Data subject requests** needs `Default`. Turning the feature on after the connection exists does not widen the grant it already holds, so re-authenticate the connection.
2. **A credential rotated at the vendor is not picked up here.** **Account SID**, **Auth Token**, **API Key** and 1 more are stored when you save the connection, so regenerating the value at the vendor breaks the next scan until it is re-pasted here. Recording the expiry on the connection means Relyance warns you before it lapses.

<!-- failure-modes:end -->

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

### Access token

```hcl
resource "relyance_integration_connection" "twilio_0" {
  vendor = "twilio"
  name   = "<your connection name>"

  auth = {
    method = "access-token"
    params = {
      data_storage_location = "us"
    }
    # Secret fields are write-only: sent to Relyance, never stored in state.
    secrets_wo = {
      SID = var.twilio_sid
      AUTH_TOKEN = var.twilio_auth_token
    }
    secrets_wo_version = 1
  }

  scans = { "data-inspection" = { enabled = true } }
}
```

### API key

```hcl
resource "relyance_integration_connection" "twilio_1" {
  vendor = "twilio"
  name   = "<your connection name>"

  auth = {
    method = "api-key"
    params = {
      data_storage_location = "us"
    }
    # Secret fields are write-only: sent to Relyance, never stored in state.
    secrets_wo = {
      API_KEY = var.twilio_api_key
      API_SECRET = var.twilio_api_secret
    }
    secrets_wo_version = 1
  }

  scans = { "data-inspection" = { enabled = true } }
}
```

<!-- terraform-examples:end -->
