Skip to main content

Webhooks

Receive real-time notifications about events in ZenSearch via connector webhooks.

Overview

ZenSearch supports receiving webhooks from connected data sources to trigger real-time sync updates. When a document changes in a connected platform (e.g., a page is updated in Confluence, a file is modified in Google Drive), the source platform sends a webhook notification to ZenSearch, which processes the change immediately.

This enables near real-time search index updates without waiting for scheduled syncs.

How It Works

  1. Configure webhooks in your source platform (e.g., GitHub, Confluence, Slack)
  2. Point the webhook URL to your ZenSearch instance
  3. When changes occur, the source platform notifies ZenSearch
  4. ZenSearch processes only the changed content (incremental sync)

Supported Connectors

ConnectorWebhook SupportEvents
S3YesObject created/modified/deleted
Google DriveYesFile changes
SharePointYesDocument changes
ConfluenceYesPage created/updated/deleted
SlackYesMessages, file uploads
GitHubYesPush, PR, issue events
JiraYesIssue created/updated
SalesforceYesRecord changes
HubSpotYesObject changes

Webhook Payload

Headers

X-Webhook-ID: wh_abc123
X-Webhook-Signature: sha256=...
X-Webhook-Timestamp: 1705766400
Content-Type: application/json

Body

{
"id": "evt_abc123",
"type": "sync.completed",
"timestamp": "2024-01-20T14:00:00Z",
"data": {
"connectorId": "conn_xyz",
"jobId": "job_123",
"documentsProcessed": 150,
"duration": 45000
}
}

Event Types

EventDescription
sync.startedSync job started
sync.completedSync job completed
sync.failedSync job failed
document.indexedDocument indexed
document.deletedDocument deleted
connector.createdConnector created
connector.deletedConnector deleted

Verifying Signatures

Verify webhook authenticity using the signature:

Node.js

const crypto = require('crypto');

function verifySignature(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return `sha256=${expected}` === signature;
}

Python

import hmac
import hashlib

def verify_signature(payload, signature, secret):
expected = hmac.new(
secret.encode(),
payload.encode(),
hashlib.sha256
).hexdigest()
return f"sha256={expected}" == signature

Retry Policy

Failed deliveries are retried:

AttemptDelay
1Immediate
21 minute
35 minutes
430 minutes
52 hours

After 5 failures, the webhook is disabled.

Best Practices

  1. Respond quickly: Return 2xx within 5 seconds
  2. Process async: Queue events for processing
  3. Verify signatures: Always validate authenticity
  4. Handle duplicates: Events may be delivered multiple times
  5. Monitor failures: Set up alerting for webhook failures

Next Steps