> ## Documentation Index
> Fetch the complete documentation index at: https://ai-kb.automationanywhere.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio Toolkit

> Connects Twilio to EKB agents and workflows to send SMS messages through a Twilio account.

The Twilio toolkit connects a Twilio account to EKB and lets agents and workflows send SMS messages. You can configure an SMS-capable sender, send messages with the **Send SMS** action, and use the **Custom API Call** action for Twilio REST API operations not covered by a dedicated node.

## Prerequisites

* An active Twilio account.
* A Twilio Account SID and Auth Token.
* An SMS-capable Twilio phone number.
* Access to an EKB project where you can configure toolkits.
* A verified destination number when using a Twilio trial account.

<Warning>
  Never expose the Twilio Auth Token, Account SID, or Authorization header in workflow inputs, prompts, screenshots, tickets, logs, or documentation. Trial accounts can send SMS only to verified recipient numbers.
</Warning>

## Setup

<Steps>
  <Step title="Create or access your Twilio account">
    Sign in to the Twilio Console or create a Twilio account, then complete the required account and phone-number verification steps.
  </Step>

  <Step title="Obtain the Account SID and Auth Token">
    In the Twilio Console, open **Account → Account Info**. Copy the Account SID and securely copy the Auth Token revealed with **Show**.
  </Step>

  <Step title="Configure an SMS-capable sender number">
    In the Twilio Console, open **Phone Numbers → Manage → Active numbers** and confirm that the account has an SMS-capable phone number. Provision one if needed and confirm that it supports SMS for the countries where messages will be sent.
  </Step>

  <Step title="Add Twilio to an EKB workflow">
    In EKB, open the required project, create or edit a workflow, add a toolkit step, search for **Twilio**, select the toolkit, and choose the **Send SMS** action.
  </Step>

  <Step title="Create the Twilio connection">
    Open the connection selector, click **Create Twilio Connection**, enter a recognizable connection name, the Account SID, and the Auth Token, then click **Save**. EKB validates the credentials before saving the connection.
  </Step>

  <Step title="Configure the Send SMS action">
    Set **From** to an SMS-capable Twilio number owned by the connected account, **To** to the recipient number in E.164 format, and **Body** to the SMS content. All three fields are required.
  </Step>

  <Step title="Test the workflow">
    Use **Run Step** to test the Twilio action or **Run Flow** to execute the workflow. Check the Results panel and confirm that the destination receives the SMS.
  </Step>
</Steps>

## Available tools

### Messaging

| Tool         | Description                                                   |
| ------------ | ------------------------------------------------------------- |
| **Send SMS** | Sends a new SMS message through the connected Twilio account. |

### Custom API Operations

| Tool                | Description                                                                                            |
| ------------------- | ------------------------------------------------------------------------------------------------------ |
| **Custom API Call** | Makes an authenticated request to a Twilio REST API endpoint not covered by a dedicated workflow node. |

## Use cases

* Send appointment reminders after a booking step and pass the returned message SID to a later workflow step.
* Send notifications or other transactional SMS messages from EKB workflows.
* Retrieve the latest status of a previously sent SMS using the returned message SID and **Custom API Call**.
* Use Twilio REST API endpoints that are not covered by a dedicated workflow node.

## Troubleshooting

| Symptom                                             | Likely cause                                                                                                            | Fix                                                                                                                                                                   |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Invalid Account SID or Auth Token                   | Credentials are invalid, mismatched, or the Auth Token has been rotated.                                                | Confirm the SID and token belong to the same Twilio account and recreate or update the EKB connection when credentials change.                                        |
| The From number is unavailable                      | The connected account does not own an active SMS-capable sender number.                                                 | Confirm the selected connection owns an active SMS-capable Twilio number and refresh or reselect the connection after provisioning a new number.                      |
| Trial account cannot send the message               | The destination is not verified, messaging to the country is restricted, or the trial account lacks sufficient balance. | Verify the destination number in Twilio, check country restrictions, and confirm sufficient trial balance.                                                            |
| Invalid destination number                          | The number is not in E.164 format.                                                                                      | Use a leading `+`, country code, and subscriber number without spaces, brackets, or local dialing prefixes.                                                           |
| Message is queued but not delivered                 | Twilio accepted the API request, but final delivery has not been confirmed.                                             | Use the Twilio Console messaging logs and search by the message SID returned by EKB to review the delivery status and error code.                                     |
| Duplicate SMS may be sent after an uncertain result | An automatic retry was performed after the request status was uncertain.                                                | Do not automatically retry an uncertain SMS request because it may send the same message twice.                                                                       |
| Custom API Call fails                               | The URL is not a relative Twilio API endpoint or credentials were supplied manually.                                    | Use a relative endpoint such as `Messages.json` or `Messages/{MessageSid}.json`; do not enter the full `api.twilio.com` URL, Account SID, or an Authorization header. |
