This project demonstrates how to:
- Set up a basic FastAPI server to receive webhook events from Hume's Empathic Voice Interface (EVI).
- Handle
chat_started
andchat_ended
webhook events. - Process events to create workflows, such as generating transcripts or logging session details.
Key Features:
- Webhook integration: Configurable endpoint to receive real-time events.
- Event handling: Parse and process
chat_started
andchat_ended
events with Python utilities. - Extensibility: A base framework for building advanced workflows triggered by EVI events.
Ensure your environment meets the following requirements:
- Python: Version
3.11.6
or higher - Poetry: Version
1.7.1
or higher
If you need to update or install Poetry, visit the official Poetry website.
- Obtain Your API Key: Follow the instructions in the Hume documentation to acquire your API key.
- Create a
.env
File: In the project's root directory, create a.env
file if it doesn't exist. Add your API key:
HUME_API_KEY="<YOUR_API_KEY>"
Refer to .env.example
as a template.
Install the required dependencies with Poetry: poetry install
Start the FastAPI server by running the app.py
file:
python app.py
Use ngrok or a similar tool to expose your local server to the internet:
ngrok http 5000
Copy the public URL generated by ngrok and update your webhook configuration in the Hume Config:
- Webhook URL:
<NGROK_PUBLIC_URL>/hume-webhook
- Events: Subscribe to
chat_started
andchat_ended
.
- Webhook Endpoint: The FastAPI server listens for POST requests at
/hume-webhook
. - Event Processing:
chat_started
: Logs session details or triggers workflows.chat_ended
: Processes chat data to generate transcripts or perform analytics.
- Custom Logic: Extend the event handler functions in
app.py
to integrate with your systems.