Skip to content

Latest commit

 

History

History
93 lines (58 loc) · 3.25 KB

File metadata and controls

93 lines (58 loc) · 3.25 KB

Empathic Voice Interface | TypeScript Webhook Example

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

Overview

This project demonstrates how to:

  • Set up a basic (Node) Express 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

To run this project locally, ensure your development environment meets the following requirements:

To check the versions of pnpm and Node.js installed on a Mac via the terminal, you can use the following commands:

  1. For Node.js, enter the following command and press Enter:
node -v

This command will display the version of Node.js currently installed on your system, for example, v21.6.1.

  1. For pnpm, type the following command and press Enter:
pnpm -v

This command will show the version of pnpm that is installed, like 8.10.0.

If you haven't installed these tools yet, running these commands will result in a message indicating that the command was not found. In that case, you would need to install them first. Node.js can be installed from its official website or via a package manager like Homebrew, and pnpm can be installed via npm (which comes with Node.js) by running npm install -g pnpm in the terminal.

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 pnpm: pnpm install

Usage

Running the server

Start the Express server by running the main.ts file:

pnpm start

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 Express 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 main.ts to integrate with your systems.