Webhooks
EVI webhooks send structured payloads to your specified URL in real time, allowing your application to respond to key events during EVI Chat sessions. They enable you to connect EVI with your systems to monitor events, automate workflows, and gain valuable insights into user interactions.
Looking for example code? See example projects in TypeScript and Python on GitHub:
See EVI WebHooks implemented in TypeScript.
See EVI WebHooks implemented in Python.
Supported events
The following section details each supported event, including what triggers the event, the structure of its payload, and practical use cases to help you integrate it into your workflows.
Chat started
Trigger
The chat_started
event is triggered when a new Chat session is started. This includes both new and resumed
sessions.
Use cases
- Workflow initiation: Use this event to trigger workflows such as starting a logging session, updating a dashboard, or notifying a team.
- Activity monitoring: Track when new or resumed sessions occur to measure usage trends or generate real-time analytics.
- Custom integrations: Push session start data to third-party systems (e.g., Zapier) to automate downstream actions like data collection or tracking.
Payload structure
Sample payload
Chat ended
Trigger
The chat_ended
event is triggered when a Chat session is ended.
Use cases
- Analytics: Measure session durations and analyze reasons for chat termination to improve performance or user experience.
- Workflow automations: Automatically process transcripts or save session data to external systems for further analysis or reporting.
- Error monitoring: Track sessions that terminate with an error or timeout to identify and address recurring issues.
Payload structure
Sample payload
Subscribing to events
To receive event notifications, define your webhook URL and specify the events you want to subscribe to within your
EVI Config. The example below
demonstrates how to configure a webhook URL for the chat_started
and chat_ended
events:
Handling events
When EVI sends event payloads to your webhook URL, your application can process them by implementing a handler. Below
are simplified example implementations in TypeScript and Python for handling chat_started
and chat_ended
events.
Security
To ensure the authenticity and integrity of webhook payloads, EVI includes an HMAC signature and a timestamp in each request. Implementing verification safeguards your application from tampering and replay attacks.
Verifying Authenticity
Each webhook request contains the following headers:
X-Hume-AI-Webhook-Signature
: HMAC-SHA256 signature of the payload and timestamp, signed with your Webhook Secret.X-Hume-AI-Webhook-Timestamp
: Unix timestamp indicating when the request was sent.
To verify authenticity:
- Retrieve the
X-Hume-AI-Webhook-Signature
andX-Hume-AI-Webhook-Timestamp
headers. - Concatenate the payload and timestamp, then compute the HMAC-SHA256 hash using your Webhook Secret.
- Compare the computed hash with the provided signature using a timing-safe comparison.
Preventing Replay Attacks
Validate the X-Hume-AI-Webhook-Timestamp
header to ensure the request is recent:
- Check if the timestamp is within a predefined range (e.g., 3 minutes from the current time).
- Reject requests with timestamps outside this range.