Webhooks
Receive real-time event notifications from GudDesk via webhooks.
Webhooks let you receive HTTP POST notifications when events happen in your GudDesk workspace. Use them to sync data, trigger workflows, or power AI agents.
Setting Up Webhooks
Via Dashboard
- Go to Workspace Settings > Webhooks
- Click Add Endpoint
- Enter your webhook URL
- Select the events you want to receive
- Copy the signing secret for signature verification
Via API (Agent Auto-Registration)
AI agents can programmatically register webhooks using the API:
curl -X POST https://guddesk.com/api/agent/webhooks \
-H "Authorization: Bearer gd_abc123..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-agent.com/webhook",
"events": {
"onMessageCreated": true,
"onConversationCreated": true
}
}'The response includes the signing secret. If a webhook with the same URL already exists, the existing endpoint is returned.
Event Types
| Event | Field | Description |
|---|---|---|
| Message Created | onMessageCreated | A new message was sent (visitor, agent, or bot) |
| Conversation Created | onConversationCreated | A new conversation was started |
| Conversation Closed | onConversationClosed | A conversation was closed |
| Conversation Assigned | onConversationAssigned | A conversation was assigned to an agent |
Verifying Signatures
Every webhook request includes an HMAC SHA-256 signature in the X-GudDesk-Signature header for verification:
X-GudDesk-Signature: sha256=abc123...
Verify the signature using your webhook secret:
import crypto from "crypto";
function verifyWebhook(payload: string, signature: string, secret: string) {
const expected = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return `sha256=${expected}` === signature;
}Always verify signatures in production to ensure requests are genuinely from GudDesk.
Testing Webhooks
For local development, use a tunneling service like ngrok:
ngrok http 3001
# Use the ngrok URL as your webhook endpointWhen running GudDesk locally (localhost:3000) and your agent locally (localhost:3001), you can register webhooks with HTTP URLs — no HTTPS required for local development.
Best Practices
- Respond quickly — Return a 200 status within 5 seconds. Do heavy processing asynchronously.
- Verify signatures — Always validate the
X-GudDesk-Signatureheader in production. - Graceful shutdown — If your agent registered a webhook programmatically, unregister it on shutdown via
DELETE /api/agent/webhooks.