Skip to main content

What are Webhooks?

Webhooks allow you to be notified when changes are made to parts of the Mindset AI system—without needing to repeatedly check by calling an API. You can use webhooks to:
  • Be notified of changes made by users to agent configuration
  • Monitor processing status of files you send to the ContextFiles API for ingestion
  • Track when contexts are created, updated, or deleted
  • Receive notifications when agents are modified
When these events occur, you’ll automatically receive notifications at your specified endpoint.

Real-World Example

When a tenant admin creates a new AI agent, you receive a notification allowing you to:

Update Database

Update your database automatically

Send Notifications

Send notifications to other administrators

Trigger Workflows

Trigger custom workflows

Update Analytics

Update analytics dashboards and log audit trails

Why Use Webhooks?

Automatic notifications → Minimal load, immediate response
Notified within 5 seconds of changes
No need to constantly poll APIs
React immediately to tenant actions
Every change recorded with timestamps

Supported Events

Webhooks fire for 3 resource types:

Agents

Events:
  • agent.created
  • agent.updated
  • agent.deleted
Description: AI agents configured by tenants
Events:
  • context.created
  • context.updated
  • context.deleted
Description: Knowledge bases and document collections
Events:
  • contextfile.created
  • contextfile.updated
  • contextfile.deleted
Description: Files uploaded to contexts
Webhooks fire for all tenants in your app. Use the externalTenantId field in each payload to identify which tenant made the change.

Quick Start Guide

Step 1: Create Your Webhook Endpoint

Create an HTTPS endpoint that accepts POST requests:
Security: Webhook endpoints MUST use HTTPS in production.

Step 2: Register Your Webhook

API Endpoint:
Request:
Response:
Important: Save the secret! You’ll need it to verify webhook signatures. Store it securely (environment variable or secrets manager).

Step 3: Test Your Integration

1

Make a Change

Make a change in the AMS SDK (create an agent, upload a file, etc.)
2

Verify Receipt

Verify your endpoint receives the webhook
3

Check Logs

Check the browser console or server logs

Webhook Payload Structure

HTTP Headers

Payload Example

Key Fields

Security: Verify Signatures

Critical: Always verify webhook signatures to prevent unauthorized requests.

Handle Webhook Events

Basic Event Handling

Prevent Duplicate Processing (Idempotency)

Webhooks may be delivered multiple times. Use eventId to process each event only once:

Respond Quickly (Async Processing)

Respond within 5 seconds. Move heavy work to background:
Always respond to webhook requests within 5 seconds to prevent timeouts.

Manage Webhooks

List All Webhooks

Update Webhook

Pause Webhook

Delete Webhook

Best Practices

  • Always verify signatures
  • Use HTTPS endpoints
  • Store secrets securely
  • Rotate secrets periodically
  • Respond within 5 seconds
  • Implement idempotency using eventId
  • Handle failures gracefully
  • Process heavy work asynchronously
  • Log successful and failed deliveries
  • Monitor lastTriggeredAt timestamps
  • Alert on extended periods without webhooks

Troubleshooting

Webhooks Not Received

1

Check Webhook Status

Webhook is registered and active: true
2

Verify Endpoint URL

Endpoint URL is correct and accessible
3

Check Firewall

Firewall allows HTTPS traffic from Mindset servers

Signature Verification Fails

Check:
Using correct secret from registration response
Using raw request body (not parsed JSON)
UTF-8 encoding is correct

Duplicate Deliveries

Solution: Implement idempotency using eventId (see example above)

Complete Working Example