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.
Available Webhook Events
Fewzen AI supports the following webhook events:
- agent.created
- agent.updated
- agent.deleted
- agent.trained
- conversation.started
- conversation.ended
- message.sent
- message.received
- knowledge.added
- knowledge.updated
- knowledge.deleted
- system.error
- rate_limit.exceeded
- account.updated
Setting Up Webhooks
- Log in to your Fewzen AI dashboard
- Navigate to the "Webhooks" section
- Click on "Add New Webhook"
- Enter the URL where you want to receive webhook events
- Select the events you want to subscribe to
- Set up a secret key for webhook signature verification (recommended)
- 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
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