Skip to content

Webhooks

Webhooks allow your application to receive real-time notifications when events occur in your MyGPTAssistants account. Real-time

  1. Navigate to Settings

    Go to Settings → Webhooks in your dashboard.

  2. Click Add Webhook

    Start creating a new webhook endpoint.

  3. Enter your endpoint URL

    Must use HTTPS for security.

  4. Select events

    Choose which events you want to receive.

  5. 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.

EventDescription
conversation.createdNew conversation started
conversation.updatedConversation received new message
conversation.completedConversation marked as resolved

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": {}
}
}

Verifying Webhooks Security

Section titled “Verifying Webhooks ”
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 handler
app.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');
});

Automatic 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.

AttemptDelay
1Immediate
25 minutes
330 minutes
42 hours
58 hours

Dashboard Test

Use the Test button in webhook settings to send a test event.

ngrok

Expose localhost to the internet for local testing.

ngrok.com

webhook.site

Inspect webhook payloads in real-time.

webhook.site

  1. Always verify signatures

    Never trust unverified webhook requests.

  2. Respond quickly

    Return 200 immediately, process async.

  3. Handle duplicates

    Store event IDs to ensure idempotency.

  4. Monitor failures

    Set up alerts for webhook delivery issues.

  5. Use queues

    Queue events for reliable processing at scale.

IssueSolution
Not receiving webhooksCheck endpoint URL is HTTPS and publicly accessible
Signature verification failsEnsure you’re using the raw body, not parsed JSON
Events arriving lateCheck retry schedule; may be retrying after failures
Missing eventsVerify the event type is selected in webhook settings