Request Payload
When a user sends a message, your integration receives a POST request with this structure:Complete Example
Payload Fields
messages
Array of conversation messages following the OpenAI/Anthropic format. Type:Array<Message>
Message Object:
user: Messages from the end userassistant: Previous responses from your botsystem: System instructions (if configured)
history_limit setting (default: 10).
Order: Messages are ordered chronologically, oldest first.
conversation_id
Unique identifier for this conversation. Type:string
Format: conv_ followed by alphanumeric characters
Example: "conv_abc123def456"
Usage:
- Track conversations across messages
- Store user context or state
- Retrieve conversation history via API
user
Information about the user sending the message. Type:object
Fields:
Note: Not all fields are available on all platforms. For example, Slack may not provide
username.
bot
Information about your bot. Type:object
Fields:
Usage:
- Identify which bot received the message (if you manage multiple)
- Include bot name in responses
- Customize behavior per bot
channel
Information about the channel that received the message. Type:object
Fields:
metadata
Platform-specific metadata and message context. Type:object
Common Fields:
Platform-Specific Metadata:
Telegram:
Response Format
Your webhook must return JSON with acontent field.
Simple Response
The minimum required response:content(string): The message to send to the user
Response with Metadata
Include optional metadata for logging and analytics:model: AI model usedtokens: Token countprocessing_time_ms: Processing duration- Any custom fields for your analytics
Error Response
Return appropriate HTTP status codes for errors:Always return valid JSON. If your backend returns invalid JSON or HTML, the platform cannot process the response.
Special Response Types
Async Processing
For long-running operations, return an immediate acknowledgment:Empty Response
To acknowledge a message without responding:204 No Content status with no body.
Use cases:
- Commands that don’t need a response
- Silent processing
- Reaction-only interactions (future feature)
Platform-Specific Considerations
Telegram
Character Limits:- Maximum message length: 4096 characters
- Messages longer than this will be truncated
Slack
Character Limits:- Maximum message length: 40,000 characters
- Responses automatically sent to the same thread
- No special handling needed
Discord
Character Limits:- Maximum message length: 2000 characters
Example Integrations
OpenAI Proxy
Anthropic Proxy
Custom Backend
Security
Validating Requests
Verify requests come from Chatbot Platform: Option 1: API Key HeaderBest Practices
Use HTTPS
Always use HTTPS endpoints to encrypt data in transit
Validate Input
Sanitize and validate all incoming data
Rate Limiting
Implement rate limiting on your webhook endpoint
Timeout Handling
Return responses within configured timeout
Testing
Manual Testing with cURL
Expected Response
Troubleshooting
Invalid JSON Response
Problem: Bot sends error message to user Solution:- Ensure response is valid JSON
- Check
contentfield is present and is a string - Look for encoding issues (use UTF-8)
- Test with JSON validator
Timeout Errors
Problem: Requests timeout before completion Solution:- Increase timeout in integration settings
- Optimize backend for faster responses
- Consider async processing for long operations
- Check network latency
Missing Fields
Problem: Expected fields not in payload Solution:- Check platform support for field
- Verify channel is properly configured
- Review platform-specific limitations
- Handle missing fields gracefully
Complete API Reference
View the full API specification with all endpoints, parameters, and response schemas.
Next Steps
Webhook Setup
Configure your webhook integration
Async Replies
Handle long-running operations
Custom Headers
Add authentication headers