This project demonstrates how to:
- Set up a basic FastAPI server to receive webhook events from Hume's Empathic Voice Interface (EVI).
- Handle
chat_startedandchat_endedwebhook 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_startedandchat_endedevents 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.6or higher - Poetry: Version
1.7.1or 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
.envFile: In the project's root directory, create a.envfile 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_startedandchat_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.pyto integrate with your systems.
