This documentation is not accurate and is currently under development.

API Webhooks

Webhooks allow you to receive real-time notifications about events in your Fewzen AI account. Instead of constantly polling the API for updates, webhooks push information to your specified endpoint as events occur. This guide explains how to set up, use, and manage webhooks with Fewzen AI.

Fewzen AI Webhooks Overview

Available Webhook Events

Fewzen AI supports the following webhook events:

Agent Events
  • agent.created
  • agent.updated
  • agent.deleted
  • agent.trained
Conversation Events
  • conversation.started
  • conversation.ended
  • message.sent
  • message.received
Knowledge Base Events
  • knowledge.added
  • knowledge.updated
  • knowledge.deleted
System Events
  • system.error
  • rate_limit.exceeded
  • account.updated

Setting Up Webhooks

Setting Up Webhooks via Dashboard
  1. Log in to your Fewzen AI dashboard
  2. Navigate to the "Webhooks" section
  3. Click on "Add New Webhook"
  4. Enter the URL where you want to receive webhook events
  5. Select the events you want to subscribe to
  6. Set up a secret key for webhook signature verification (recommended)
  7. Click "Create Webhook" to save your configuration

Webhook Payload Structure

When an event occurs, Fewzen AI will send a POST request to your specified webhook URL with a JSON payload. Here's an example of a webhook payload:

{
  "id": "evt_123456789",
  "type": "conversation.started",
  "created": 1634567890,
  "data": {
    "conversation_id": "conv_987654321",
    "agent_id": "agt_246813579",
    "user_id": "usr_135792468",
    "timestamp": "2023-04-15T10:30:00Z"
  }
}

The payload includes a unique event ID, the event type, a timestamp, and relevant data specific to the event type.

Best Practices for Webhook Implementation

Verify Webhook Signatures
Always verify the webhook signature using your secret key to ensure the request came from Fewzen AI.
Implement Retry Logic
Be prepared to handle temporary failures by implementing a retry mechanism with exponential backoff.
Use Asynchronous Processing
Process webhook events asynchronously to avoid blocking and ensure quick response times.
Respond Quickly
Return a 2xx status code as soon as you receive the webhook to acknowledge receipt, then process it later.

Troubleshooting Webhooks

If you're experiencing issues with webhooks, try the following:

  • Check your webhook logs in the Fewzen AI dashboard for delivery attempts and error messages
  • Verify that your endpoint is publicly accessible and can receive POST requests
  • Ensure your server is responding with a 2xx status code to acknowledge receipt
  • Double-check that you're correctly verifying the webhook signature
  • Monitor your endpoint's uptime and performance to prevent delivery failures

Ready to Implement Webhooks?

Webhooks are a powerful way to keep your systems in sync with Fewzen AI events in real-time. Start implementing webhooks today to create more responsive and efficient applications.

Explore SDKs and Libraries