Conversation Events
Most Common
Track conversation lifecycle: created, updated, completed.
Webhooks allow your application to receive real-time notifications when events occur in your MyGPTAssistants account. Real-time
Navigate to Settings
Go to Settings → Webhooks in your dashboard.
Click Add Webhook
Start creating a new webhook endpoint.
Enter your endpoint URL
Must use HTTPS for security.
Select events
Choose which events you want to receive.
Save and copy secret
Store your signing secret securely - you’ll need it for verification.
Conversation Events
Most Common
Track conversation lifecycle: created, updated, completed.
Message Events
Get notified for every message sent by users or assistant.
Bot Events
Monitor when bot settings change or bot is published.
| Event | Description |
|---|---|
conversation.created | New conversation started |
conversation.updated | Conversation received new message |
conversation.completed | Conversation marked as resolved |
| Event | Description |
|---|---|
message.created | New message sent (user or assistant) |
message.updated | Message was edited |
message.deleted | Message was removed |
| Event | Description |
|---|---|
bot.updated | Bot settings changed |
bot.published | Bot published to production |
bot.disabled | Bot was disabled |
All webhook payloads follow this structure:
{ "id": "evt_abc123", "type": "conversation.created", "timestamp": "2024-01-15T10:30:00Z", "data": { "conversationId": "conv_123456", "botId": "bot_789", "metadata": {} }}import crypto from 'crypto';
function verifyWebhook(payload, signature, secret) { const expectedSignature = crypto .createHmac('sha256', secret) .update(payload) .digest('hex');
return crypto.timingSafeEqual( Buffer.from(signature), Buffer.from(`sha256=${expectedSignature}`) );}
// In your webhook handlerapp.post('/webhook', (req, res) => { const signature = req.headers['x-mga-signature']; const payload = JSON.stringify(req.body);
if (!verifyWebhook(payload, signature, WEBHOOK_SECRET)) { return res.status(401).send('Invalid signature'); }
// Process the webhook const event = req.body; console.log(`Received ${event.type}`);
res.status(200).send('OK');});import hmacimport hashlibfrom flask import Flask, request
def verify_webhook(payload: bytes, signature: str, secret: str) -> bool: expected = hmac.new( secret.encode(), payload, hashlib.sha256 ).hexdigest() return hmac.compare_digest(f"sha256={expected}", signature)
@app.route('/webhook', methods=['POST'])def handle_webhook(): signature = request.headers.get('X-MGA-Signature') payload = request.get_data()
if not verify_webhook(payload, signature, WEBHOOK_SECRET): return 'Invalid signature', 401
event = request.json print(f"Received {event['type']}")
return 'OK', 200Automatic Retries
Failed deliveries (non-2xx) are automatically retried.
Exponential Backoff
Retry delays increase with each attempt.
Manual Retry
After 5 failures, retry manually from dashboard.
| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 5 minutes |
| 3 | 30 minutes |
| 4 | 2 hours |
| 5 | 8 hours |
Dashboard Test
Use the Test button in webhook settings to send a test event.
ngrok
Expose localhost to the internet for local testing.
webhook.site
Inspect webhook payloads in real-time.
Always verify signatures
Never trust unverified webhook requests.
Respond quickly
Return 200 immediately, process async.
Handle duplicates
Store event IDs to ensure idempotency.
Monitor failures
Set up alerts for webhook delivery issues.
Use queues
Queue events for reliable processing at scale.
| Issue | Solution |
|---|---|
| Not receiving webhooks | Check endpoint URL is HTTPS and publicly accessible |
| Signature verification fails | Ensure you’re using the raw body, not parsed JSON |
| Events arriving late | Check retry schedule; may be retrying after failures |
| Missing events | Verify the event type is selected in webhook settings |