Skip to Content
Webhooks

Webhooks

Receive real-time notifications when forms are submitted.

Webhook Payload

When a form is submitted, Trigglio sends a POST request to your webhook URL with the following payload:

{ "eventType": "form_response", "eventId": "evt_unique_id", "createdAt": "2024-01-15T10:30:00Z", "data": { "formId": "frm_abc123", "formName": "Contact Form", "responseId": "resp_xyz789", "fields": [ { "key": "name", "label": "Full Name", "type": "short_text", "value": "John Doe" }, { "key": "email", "label": "Email Address", "type": "email", "value": "john@example.com" }, { "key": "message", "label": "Your Message", "type": "long_text", "value": "I have a question about your service..." } ] }, "metadata": { "source": "direct" // "direct" | "embed" | "chatbot" } }

Field Types

TypeDescription
short_textSingle line text input
long_textMulti-line textarea
emailEmail address
phonePhone number
numberNumeric input
dateDate picker
dropdownSelect dropdown
multiple_choiceRadio buttons
checkboxesMultiple selection
fileFile upload (returns URL)
signatureSignature (returns image URL)
ratingStar rating
systemSystem fields like _formId, _responseId

Handling Webhooks

Your webhook endpoint should:

  1. Respond with a 200 status code to acknowledge receipt
  2. Process the data asynchronously if needed
  3. Handle retries gracefully (Trigglio may retry on failure)
import express from 'express'; const app = express(); app.use(express.json()); app.post('/webhook', (req, res) => { const { eventType, data } = req.body; if (eventType === 'form_response') { console.log('New form submission!'); console.log('Form:', data.formName); console.log('Response ID:', data.responseId); // Process each field for (const field of data.fields) { console.log(`${field.label}: ${field.value}`); } } // Always respond with 200 to acknowledge receipt res.status(200).json({ received: true }); }); app.listen(3000, () => console.log('Webhook server running on port 3000'));

Knowledge Source Events

Subscribe to knowledge source lifecycle events to get notified when sources are created, processed, or deleted.

EventDescription
knowledge.source.createdA new knowledge source was created
knowledge.source.readyA source finished processing and is searchable
knowledge.source.errorA source failed to process
knowledge.source.deletedA source was deleted

Payload example (knowledge.source.ready):

{ "eventType": "knowledge.source.ready", "eventId": "evt_abc123", "createdAt": "2024-06-15T10:35:00Z", "data": { "sourceId": "src_xyz789", "sourceName": "Product FAQ", "sourceType": "text", "chatbotId": "cm_abc123", "status": "ready", "chunkCount": 12 } }

Payload example (knowledge.source.error):

{ "eventType": "knowledge.source.error", "eventId": "evt_def456", "createdAt": "2024-06-15T10:36:00Z", "data": { "sourceId": "src_xyz789", "sourceName": "Company Website", "sourceType": "url", "chatbotId": "cm_abc123", "status": "error", "error": "Failed to fetch URL: 404 Not Found" } }

Testing Webhooks

Use the Get Sample Payload endpoint to get a sample payload for testing:

curl -X GET "https://trigglio.com/api/integrations/webhooks/triggers/sample?formId=frm_abc123" \ -H "Authorization: Bearer tr_live_your_api_key"

For local development, use a tool like ngrok  to expose your local server to the internet.

Retry Policy

If your webhook endpoint returns a non-2xx status code, Trigglio will retry the request:

  • 3 retries with exponential backoff
  • Retries occur at approximately 1 minute, 5 minutes, and 30 minutes
  • After 3 failed attempts, the webhook is marked as failed

Make sure your endpoint is idempotent — use the eventId to detect duplicate deliveries.

Last updated on