Chatzuri Logo
  • Affiliates
  • Pricing
  • API
  • Guides
  • Blog
  • Affiliates
  • Pricing
  • API
  • Guides
  • Blog

API Documentation

  • Getting Started

    Getting Setup
  • Teams

    Teams Overview
  • Create a Team
  • Get Teams
  • Update a Team
  • Delete a Team
  • Agents

    Create an Agent
  • Message an Agent
  • Update an Agent
  • Delete an Agent
  • Get Agents
  • Stream Messages
  • Update Agent Settings
  • Upload Agent Icon
  • Delete Agent Icon
  • Upload Agent Profile Picture
  • Delete Agent Profile Picture
  • Data

    Get Leads
  • Get Conversations
  • Integrations

    Webhooks API
  1. Home
  2. API Docs
  3. Webhook API

Webhook API Guide

This page helps you setting up your agent webhooks.

The Webhook API guide allows you to set-up webhooks to receive a POST request when an event is triggered.

Payload Structure

KeyTypeDescription
eventTypestringevent type (eg. lead.submit)
agentIdstringAgent ID
payloadObjectPayload of the event
1{ 2 "eventType": "string", // event type (eg. lead.submit) 3 "agentId": "string", // Agent ID 4 "payload": { // Payload of the event 5 // ... event specific data 6 } 7}

Event Types

These are the list of events supported in webhooks.

lead.submit

When a customer submits their info (Name, Email, and Phone) to your agent.

1{ 2 "conversationId": "string", 3 "customerEmail": "string", 4 "customerName": "string", 5 "customerPhone": "string" 6}

Channel Integrations

Webhooks are used to receive events from all messaging channels your agent is connected to. Each channel delivers events to the same webhook URL with a channel field so you can route them appropriately.

WhatsApp

channel: "whatsapp"

Received when a user sends a message to your WhatsApp business number connected to the agent.

1{ 2 "eventType": "message.received", 3 "channel": "whatsapp", 4 "agentId": "agent_abc123", 5 "payload": { 6 "from": "+1234567890", 7 "message": "Hello, I need help with my order", 8 "conversationId": "conv_xyz" 9 } 10}

Telegram

channel: "telegram"

Received when a user messages your Telegram bot linked to the agent.

1{ 2 "eventType": "message.received", 3 "channel": "telegram", 4 "agentId": "agent_abc123", 5 "payload": { 6 "chatId": 123456789, 7 "username": "john_doe", 8 "message": "What are your opening hours?", 9 "conversationId": "conv_xyz" 10 } 11}

Facebook Messenger

channel: "facebook"

Received when a user sends a message to your Facebook Page linked to the agent.

1{ 2 "eventType": "message.received", 3 "channel": "facebook", 4 "agentId": "agent_abc123", 5 "payload": { 6 "senderId": "fb_user_123", 7 "pageId": "fb_page_456", 8 "message": "Is this product still available?", 9 "conversationId": "conv_xyz" 10 } 11}

Instagram

channel: "instagram"

Received when a user sends a DM to your Instagram account linked to the agent.

1{ 2 "eventType": "message.received", 3 "channel": "instagram", 4 "agentId": "agent_abc123", 5 "payload": { 6 "senderId": "ig_user_789", 7 "message": "Do you ship internationally?", 8 "conversationId": "conv_xyz" 9 } 10}

Email

channel: "email"

Received when an inbound email arrives at your agent's connected inbox.

1{ 2 "eventType": "message.received", 3 "channel": "email", 4 "agentId": "agent_abc123", 5 "payload": { 6 "from": "customer@example.com", 7 "subject": "Order inquiry", 8 "message": "I placed an order yesterday and have not received a confirmation.", 9 "conversationId": "conv_xyz" 10 } 11}

Web Chat Widget

channel: "web"

Received when a visitor sends a message through the embedded chat widget on your website.

1{ 2 "eventType": "message.received", 3 "channel": "web", 4 "agentId": "agent_abc123", 5 "payload": { 6 "sessionId": "session_abc", 7 "message": "Hi, I need help!", 8 "conversationId": "conv_xyz", 9 "pageUrl": "https://yoursite.com/pricing" 10 } 11}

Tip: Use the channel field in the webhook payload to route incoming events to different handlers in your backend.

Receiving the Webhook Request

You can receive the payload by accessing the body same as any request.

It is recommended to check the request header x-chatzuri-signature for securing your endpoint from spam.

You can achieve this by using SHA-1 (Secure Hash Algorithm 1) function to generate a signature for the request and compare it with x-chatzuri-signature found in the request headers. If they are identical then the request is from Chatzuri.

Example Request

1import crypto from 'crypto' 2import { Request, Response } from 'express' 3 4export async function webhookHandler(req: Request, res: Response) { 5 if (req.method === 'POST') { 6 const { SECRET_KEY } = process.env 7 8 const receivedJson = req.body 9 const rawBody = Buffer.from(JSON.stringify(receivedJson)) 10 const bodySignature = sha1(rawBody, SECRET_KEY) 11 12 if (bodySignature !== req.headers['x-chatzuri-signature']) { 13 return res.status(400).json({ message: "Signature didn't match" }) 14 } 15 16 console.log('Received:', receivedJson) 17 18 res.status(200).json({ status: "accepted" }) 19 } else { 20 res.setHeader('Allow', 'POST') 21 res.status(405).end('Method Not Allowed') 22 } 23} 24 25function sha1(data: Buffer, secret: string): string { 26 return crypto.createHmac('sha1', secret).update(data).digest('hex') 27}

Respond to the Event Webhook

Return a JSON object with the following structure to indicate your endpoint has received the event webhook:

1{ 2 "status": "accepted" 3}

Error Handling

If there are any errors during the API request, appropriate HTTP status codes will be returned along with error messages in the response body.

That's it! You should now be able to retrieve list of agent's from your account using our API.

Remember to handle errors gracefully in your application
Home: API Documentation
FacebookInstagramGitHubBehancePinterestTwitterDribbble
Chatzuri

AI-powered agents are transforming customer interactions by providing instant, intelligent responses around the clock. They help businesses reduce operational costs, improve response times, and scale support without compromising quality. These agents understand natural language, learn from conversations, and integrate with existing systems to offer personalized experiences that enhance customer satisfaction and loyalty.

Chatzuri

AI-powered agents are transforming customer interactions by providing instant, intelligent responses around the clock. They help businesses reduce operational costs, improve response times, and scale support without compromising quality. These agents understand natural language, learn from conversations, and integrate with existing systems to offer personalized experiences that enhance customer satisfaction and loyalty.

Product

  • Pricing
  • Security
  • Affiliates

Resources

  • API
  • Guides
  • Blog
  • Help

Company

  • About us
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA

About

  • Teams
  • Singapore, Nairobi

© 2026 Chatzuri. All rights reserved.

Made with ❤️ for businesses worldwide

Terms of ServicePrivacy PolicyCookie PolicyTevinly