This project shows how to integrate a custom machine learning model with an API to build an AI-powered conversational bot that builds a story based on your input.
- Python 3.4 or newer
- A Twilio account — sign up
- A Twilio phone number with Voice capabilities
- A AIDungeon account — sign up
After the above requirements have been met:
- Clone this repository and
cd
into it
git clone git@github.com:KNawm/aidungeon-twilio.git
cd aidungeon-twilio
- Create a new virtual environment
python3 -m venv venv
venv\Scripts\activate
- Install dependencies
pip install -r requirements.txt
- Set your environment variables
cp .env.example .env
Open .env
in your favorite text editor and configure the following values.
Config Value | Description |
---|---|
TWILIO_ACCOUNT_SID |
Your primary Twilio account identifier - find this in the console here. |
TWILIO_AUTH_TOKEN |
Used to authenticate - you can get it at twilio.com/console. |
AIDUNGEON_EMAIL |
Your AIDungeon account email - get a free account at play.aidungeon.io. |
AIDUNGEON_PASS |
Your AIDungeon account password - just like the above, you'll get one here. |
- Run the application
flask run
Alternatively, you can use this command to start the server in development mode. It will reload whenever you change any files.
export FLASK_ENV=development
flask run
- (optional) Run ngrok
If you are going to develop or test locally, Twilio won't be able to access localhost directly. You'll need to create a publicly accessible URL using a tool like ngrok to send HTTP/HTTPS traffic to a server running on your localhost.
./ngrok http 5000
- Configure Twilio
Enter here and configure your webhook.
That's it!
This project is open source and welcomes contributions.