Skip to content

neuphonic/twilio-chatbot

Repository files navigation

Twilio Chatbot

Implements a chatbot that uses Twilio and Neuphonic Agents.

Setup

Get all the API Keys and resources set up:

  1. Head over to Twilio Docs: Make an Outbound Call to buy a phone number, get your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN.
  2. Head over to Neuphonic to get your NEUPHONIC_API_KEY.
  3. Set up your environment variables:
    cp .env.example .env
    Note - TO_NUMBER is your phone number. FROM_NUMBER is the number that you bought from Twilio.
  4. Head over to ngrok, create and account and install the CLI.

Set up your environment: Use whichever package manager you want.

pip install -r requirements.txt

Run the server:

  1. Run ngrok.
    ngrok http http://localhost:8000
    
    This will display a URL on your terminal, C+P this into the .env file as SERVER_BASE_URL This should look something like 27ce-34-147-167-1.ngrok-free.app, do not C+P the https:// at the front.
  2. Run the FastAPI server that Twilio will connect to:
    make run
    

Your local FastAPI server is now accessible via the ngrok HTTPS URL, so that Twilio can hit your server which is running on your laptop.

Initiate a call to your phone

python ./scripts/outbound_call.py

This will trigger a call to your phone, with the Neuphonic agents endpoint. All logic for this call lives in ./twilio_chatbot/routers/agent.py.

About

Twilio Chatbot Prototype

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors