Skip to content

Latest commit

 

History

History
78 lines (49 loc) · 2.43 KB

File metadata and controls

78 lines (49 loc) · 2.43 KB

Empathic Voice Interface | Python Webhook Example

Receive and Handle Webhook Events from Hume's Empathic Voice Interface (EVI)

Overview

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 and chat_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 and chat_ended events with Python utilities.
  • Extensibility: A base framework for building advanced workflows triggered by EVI events.

Prerequisites

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.


Setup

Setting up credentials

  • 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 dependencies

Install the required dependencies with Poetry: poetry install

Usage

Running the server

Start the FastAPI server by running the app.py file:

python app.py

Testing the webhook

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 and chat_ended.

How It Works

  1. Webhook Endpoint: The FastAPI server listens for POST requests at /hume-webhook.
  2. Event Processing:
    • chat_started: Logs session details or triggers workflows.
    • chat_ended: Processes chat data to generate transcripts or perform analytics.
  3. Custom Logic: Extend the event handler functions in app.py to integrate with your systems.