Webhooks API
Overview
Webhooks are HTTP callbacks that Talk2sync triggers when specific events occur in your integrated platform. Your custom application receives real-time POST requests containing event data, allowing you to synchronize products, orders, and other critical information.
How Webhooks Work
- An event occurs in Talk2sync (product update, order creation, etc.)
- Talk2sync sends an HTTP POST request to your configured endpoint
- Your application receives and processes the event data
- Your application responds with a confirmation
This is a reactive integration pattern where your system responds to changes initiated by Talk2sync.
Key Characteristics
| Feature | Details |
|---|---|
| Protocol | HTTP POST requests |
| Format | JSON |
| Authentication | Bearer token (see Quick Start) |
| Timeout | 1 minute per request |
| Frequency | Real-time, as events occur |
| Reliability | Sent once per event |
When to Use Webhooks
Webhooks are ideal when:
- ✓ You need real-time synchronization of products or orders
- ✓ You prefer Talk2sync to push changes to you
- ✓ Your system can respond quickly to incoming events
- ✓ You want to minimize latency in data synchronization
When to Use Reverse Invoke API Instead
Consider the Reverse Invoke API when:
- You want to control when synchronization happens
- Your system has specific update schedules
- You prefer to query for changes periodically
- You need more control over the sync process
Available Webhooks
Products
Manage your product catalog through webhooks:
- List Products - Retrieve all products from your system
- List Product by ID - Retrieve a specific product
- Add/Update Product - Create or update a product
Orders
Manage your sales orders through webhooks:
- List Orders - Retrieve all orders from your system
- List Order by ID - Retrieve a specific order
- Add/Update Order - Create or update an order
Request/Response Flow
Request from Talk2sync to Your Endpoint
POST /api/products
Host: www.example.com
Authorization: Bearer {YOUR_GENERATED_KEY}
Content-Type: application/json
{
"event": "product.created",
"data": {
// Event-specific data
}
}
Response from Your Endpoint
Your endpoint must respond within 1 minute with:
{
"status": "success",
"message": "Data processed successfully"
}
HTTP Status Codes:
200 OK- Request processed successfully400 Bad Request- Invalid request data401 Unauthorized- Invalid or missing security key500 Internal Server Error- Server error
Authentication
All webhook requests from Talk2sync include your security key in the Authorization header as a Bearer token. Your endpoints must:
- Extract the token from the header
- Validate it matches your generated key
- Reject requests with invalid or missing keys
- Include the same key in your response
For detailed implementation, see Generate Keys.
Getting Started
- Ensure your endpoints are configured (see Configure Connection)
- Your security key is generated (see Generate Keys)
- Select the webhooks you want to implement from the list above
- Review the detailed documentation for each webhook
- Implement the required request/response handlers in your application
Error Handling
When Talk2sync sends a webhook request:
- If your endpoint does not respond within 1 minute, the request times out
- Talk2sync will record the timeout as a failed attempt
- Check your server logs to diagnose the issue
- Ensure your endpoint processes requests efficiently
For troubleshooting, refer to the specific webhook documentation or contact Talk2sync support.
Next Steps
Choose a webhook to implement:
- Start with List Products
- Or jump to List Orders
- For complete reference, see Reverse Invoke API as an alternative approach