Skip to content

Latest commit

 

History

History
85 lines (50 loc) · 2.88 KB

README.md

File metadata and controls

85 lines (50 loc) · 2.88 KB

Build an AI Assistant with Twilio and VAPI

🚧️ UNDER CONSTRUCTION 🚧️

Disclaimer

This software is to be considered "sample code", a Type B Deliverable, and is delivered "as-is" to the user. Twilio bears no responsibility to support the use or implementation of this software.

Overview

For a detailed guide on how to integrate Twilio with VAPI AI Assistant and transfer calls between them, check out our blog post - Coming Soon!. This blog post covers step-by-step instructions on sending calls from Twilio to VAPI AI Assistant and transferring calls back to Twilio for human agents.

Happy integrating!

Prerequisites

Before getting started with this repository, make sure you have the following:

  • A Twilio account. If you don't have one, you can sign up for free at Twilio website.
  • Twilio CLI installed on your machine. You can install it by following the instructions in the Twilio CLI documentation.

Twilio Functions

This repository contains two serverless functions:

  1. create-call: This function is used to engage the VAPI AI assistant. The assistant handles interactions with the assistant and provides responses based on user input. The function calls the Create Call API

  2. transfer-call: This function is used to transfer a call to a human agent. It handles the logic for transferring the call and ensuring a smooth transition from the AI assistant to a human agent.

To use these functions, follow the deployment steps mentioned below.

Deploying the Serverless Function

To deploy the serverless function in this repository, follow these steps:

  1. Clone the repository to your local machine:
git clone https://github.com/twilio-professional-services/twilio-vapi.git
  1. Navigate to the project directory:
cd twilio-vapi

cd serverless-vapi
  1. Update the necessary configuration variables in the .env file:

    cp .env.example .env

    Open the .env file and update the following variables:

    • TWILIO_API_KEY: # Your TWILIO API Key

    • TWILIO_SECRET=:Your TWILIO API Secret

    • TWILIO_WORKFLOW_SID: Your TWILIO Workflow SID for transfering calls to human agents

    • VAPI_API_KEY: Your VAPI API Key

    • VAPI_PHONE_NUMBER_ID: Your VAPI Phone Number ID

    • VAPI_ASSISTANT_ID: Your VAPI Assistant ID

Save the changes.

Now you are ready to use the serverless functions in the twilio-vapi repository.

  1. Install the project dependencies:
npm install
  1. Deploy the serverless function using the Twilio CLI:
twilio serverless:deploy

This command will deploy the serverless function to your Twilio account.

  1. Once the deployment is successful, you will receive a URL for your serverless function. You can use this URL to access and test your function.