Overview
Webhooks allow you to receive real-time events from Convosphere AI in your application. They enable real-time integration with your systems.Setting Up Webhooks
Step 1: Create a Webhook Endpoint
Create an HTTP endpoint in your application that can receive POST requests:Step 2: Configure Webhook in Convosphere
- Go to your agent dashboard
- Navigate to Integrations → Webhooks
- Click Create Webhook
- Enter your webhook URL
- Select events you want to receive
- Save the webhook
Step 3: Verify Webhook
After creating the webhook, Convosphere AI will send a test event to verify your endpoint is working.Available Events
Message Events
message.created: Triggered when a new message is sent by a usermessage.completed: Triggered when the agent completes a response
Conversation Events
conversation.started: Triggered when a new conversation beginsconversation.ended: Triggered when a conversation ends
User Events
user.feedback: Triggered when a user provides feedback (thumbs up/down)
Error Events
error.occurred: Triggered when an error occurs during conversation
Webhook Security
Signature Verification
All webhook requests include a signature header for verification. Verify signatures to ensure requests are from Convosphere AI.Node.js Example
Retry Policy
Convosphere AI uses exponential backoff for failed webhook deliveries:- Initial Retry: 1 minute after failure
- Subsequent Retries: 2 minutes, 4 minutes, 8 minutes, 16 minutes
- Max Retries: 5 attempts
- Stop on 4xx: 4xx errors (except 429) stop retries
- Retry on 5xx: 5xx errors trigger retries
Best Practices
- Respond Quickly: Return 200 OK within 5 seconds
- Handle Idempotency: Events may be delivered multiple times
- Log Events: Keep logs for debugging
- Queue Processing: Use queues for async processing
- Error Handling: Return appropriate status codes
Testing Webhooks
Using ngrok
- Install ngrok:
npm install -g ngrok - Expose local server:
ngrok http 3000 - Use the ngrok URL as your webhook URL
Using Webhook.site
- Visit webhook.site
- Copy the unique URL
- Use it as your webhook URL
Troubleshooting
Webhook Not Receiving Events
- Verify webhook URL is accessible
- Check webhook status in dashboard
- Review webhook logs
- Ensure events are selected
- Check firewall/network settings
Signature Verification Fails
- Verify secret matches in both systems
- Check signature header name
- Ensure payload is not modified
- Verify JSON encoding