> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio Actions integration

[Back to list of integrations](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)

Use the Twilio integration to let agents send SMS, place text-to-speech calls, look up numbers, and retrieve messages and recordings through Action Tools.

| Authentication | Actions | Workflow triggers |
| - | - | - |
| Basic Auth | [6](#supported-actions) | [5](#workflow-triggers) |

## Supported actions

Actions are Twilio operations that an agent runs as Action Tools during a conversation. You can also run them from an [Integration node](https://koreai.mintlify.site/agent-platform/workflows.md#integration-node) in a workflow.

| Action | Use it to |
| - | - |
| [Send SMS](#send-sms) | Send an SMS message from a Twilio number. |
| [Call Phone](#call-phone) | Call a number and speak a message with text-to-speech. |
| [Phone Number Lookup](#phone-number-lookup) | Get information about a phone number. |
| [Get Message](#get-message) | Get the details of a message. |
| [Download Recording Media](#download-recording-media) | Download the audio file of a call recording. |
| [Custom API Call](#custom-api-call) | Call any Twilio API endpoint the other actions don't cover. |

## Workflow triggers

Triggers are Twilio events that start a workflow automatically. Select them as [app triggers](https://koreai.mintlify.site/agent-platform/workflows.md#app-triggers) when you configure a workflow.

| Trigger | Fires when |
| - | - |
| New Incoming SMS | An SMS message is received. |
| New Phone Number | You add a phone number to your account. |
| New Recording | A call recording is completed and available. |
| New Transcription | A call recording transcription is completed. |
| New Call | A call completes, incoming or outgoing. |

## Prerequisites

* A Twilio number that is SMS-capable or voice-capable. Trial accounts can message only verified numbers.

## Set up the integration

**1. Create the auth profile**

In **Integrations**, select **Twilio** > **Connect**. On **Project Auth Profiles**, select **New Profile** > **Integration Profile** > **Twilio** > **Continue**. Enter the **Account SID** as **Username** and the **Auth Token** as **Password** (both on the [Twilio Console](https://console.twilio.com/) dashboard), and select **Create Profile**.

**2. Create the action tool**

In **Tools**, select **New Tool** > **Action** > **Twilio** > **Continue**. Select the **Action** and **Auth Profile**, set parameter defaults (leave a value empty for the agent to supply at runtime), and select **Create Tool**. Set `from` as a default. Then [assign the tool to an agent](https://koreai.mintlify.site/agent-platform/tools/actions.md#assign-an-action-to-an-agent).

## Action reference

Enter all phone numbers in E.164 format, for example `+15558675310`.

> [accordion] Send SMS
>
> | Parameter | Type | Description |
> | - | - | - |
> | `from` | enum | Twilio number to send from. |
> | `body` | string | Message text. |
> | `to` | string | Recipient number. |

> [accordion] Call Phone
>
> | Parameter | Type | Description |
> | - | - | - |
> | `from` | enum | Twilio number to call from. |
> | `to` | string | Number to call. |
> | `message` | string | Text that Twilio converts to speech and speaks to the recipient. |
> | `voice` | enum | Text-to-speech voice. |
> | `language` | enum | Text-to-speech language. |
> | `sendDigits` | string | Keys to dial after the call connects. Use `w` for a half-second pause. |
> | `timeout` | number | Seconds to let the phone ring before Twilio treats the call as unanswered. |

> [accordion] Phone Number Lookup
>
> | Parameter | Type | Description |
> | - | - | - |
> | `phone_number` | string | Phone number to look up. |

> [accordion] Get Message
>
> | Parameter | Type | Description |
> | - | - | - |
> | `message_sid` | string | Message SID, which starts with `SM` or `MM`. |

> [accordion] Download Recording Media
>
> | Parameter | Type | Description |
> | - | - | - |
> | `recording_sid` | string | Recording SID, which starts with `RE`. |
> | `format` | enum | Audio format. Default: `MP3`. |
> | `channels` | enum | Mono or dual-channel file. |

> [accordion] Custom API Call
>
> Sends a request to any Twilio REST API endpoint. Artemis injects the authorization header from the auth profile.
>
> | Parameter | Type | Description |
> | - | - | - |
> | `url` | object | Endpoint URL. |
> | `method` | enum | HTTP method. |
> | `headers` | object | Additional request headers. |
> | `queryParams` | object | Query parameters. |
> | `body_type` | enum | Body type. Default: `None`. |
> | `body` | object | Request body. |
> | `response_is_binary` | boolean | Turn on for binary responses, such as PDFs or images. Default: `False`. |
> | `failsafe` | boolean | Returns no error when the call fails. |
> | `timeout` | number | Timeout, in seconds. |
> | `followRedirects` | boolean | Follows HTTP redirects. Default: `False`. |

## Troubleshoot common issues

| Issue | Resolution |
| - | - |
| `20003 Authenticate` | Confirm that **Username** is the Account SID and **Password** is its current auth token. |
| `21608` unverified number | Trial accounts can send only to verified numbers. Verify the number or upgrade the account. |
| `21211` invalid `To` number | Enter the number in E.164 format. |
| `21606` invalid `From` number | Select a Twilio number that is SMS-capable or voice-capable for the action. |
| The `from` dropdown is empty | Confirm the account has an active phone number and the profile is **Active**. |
| Messages to some countries fail | Enable the destination in **Messaging** > **Settings** > **Geo permissions** in the Twilio Console. |

**Related articles:**

* [Enterprise systems integrations](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)
* [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles)
* [Action Tools](https://koreai.mintlify.site/agent-platform/tools/actions.md)
* [Integration node](https://koreai.mintlify.site/agent-platform/workflows.md#integration-node)
* [Twilio API reference](https://www.twilio.com/docs/usage/api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.