Twilio

Overview

The Twilio connector enables your Leena AI Agents to integrate with Twilio's communications platform, facilitating automated messaging workflows including SMS, MMS, and WhatsApp messages.

Twilio is a cloud communications platform that provides APIs for sending and receiving SMS, MMS, and WhatsApp messages programmatically. The Twilio connector allows Leena AI to automate messaging workflows, send notifications, and interact with customers seamlessly through various messaging channels.

API Details

Leena AI integrates with Twilio via REST APIs.

Documentation link: https://www.twilio.com/docs/iam/api

Setup

The Twilio connector uses HTTP Basic Authentication with Account SID and Auth Token.

Prerequisites

Before setting up the Twilio connector, ensure you have:

  • An active Twilio account
  • Access to your Twilio Console
  • Twilio Account SID
  • Twilio Auth Token
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to obtain your Twilio credentials:

  1. Log in to Twilio Console (Ensure you have an active account)
  2. Navigate to Account Dashboard:
    1. From the left sidebar, go to your Account section
    2. Your Account SID will be visible on the dashboard
  3. Locate Auth Token:
    1. Click on "View" next to Auth Token to reveal it
    2. Copy both Account SID and Auth Token for use in Leena AI
  4. Note Your Credentials:
    1. Keep your Account SID and Auth Token secure

    2. These will be used for authentication in Leena AI

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Twilio" and select it from the list to add its new connector
  4. Start configuring the connector
    1. ID: Unique identifier for the connector
    2. Name: Descriptive name for your Twilio connection
    3. Auth Type: Authentication method (Account SID and Auth Token)
    4. Account SID: Your Twilio Account SID from the console
    5. Auth Token: Your Twilio Auth Token from the console
  5. Save the connector configuration
    1. Click Save to complete the setup

    2. The connector will be activated and ready to use

Actions

The following actions are supported for the Twilio connector:

Send SMS

Initiates sending of SMS or MMS messages through Twilio. The Agent can leverage the skill (workflow), which has been designed to send messages via Twilio, once the user raises a query to do so.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
ToRecipient phone number in E.164 format
FromSender's Twilio phone number in E.164 format (required if not using Messaging Service SID)
Messaging Service SIDMessaging Service SID (starts with MG, 34 characters) - alternative to using a specific From number
MessageThe text message to send (max 1,600 characters)
Content SIDTemplate SID (starts with HX, 34 characters) for sending pre-defined content templates

Optional

NameDescription
Media UrlURL of the media file for MMS messages (JPEG, PNG, GIF supported, 5MB max). Multiple media URLs can be provided.
Content VariablesJSON string with variable substitutions for content templates

Here is a sample JSON input:

{
  "To": "+14155238886",
  "From": "+15557122661",
  "Body": "Hello, this is a test SMS message from Twilio"
}

Response

Upon successful message submission, the action returns the message details including:

  • Message SID (unique identifier)
  • Account SID
  • Status (queued, sending, sent, delivered, failed, undelivered)
  • Message body
  • From and To phone numbers
  • Date created and date sent
  • Direction (outbound-api)
  • Number of media attachments
  • Number of segments
  • API version
  • Error code and error message (if applicable)