Webhooks
Webhooks
Status: Coming Soon - Webhooks are not yet available in the SearchJet API. This page describes the planned functionality.
Planned Features
Webhooks will allow SearchJet to send real-time notifications to your server when specific events occur. This eliminates the need for polling the API.
Planned Event Types
| Event | Description |
|---|---|
| document.indexed | A new document has been indexed |
| document.updated | An existing document has been updated |
| document.deleted | A document has been removed from the index |
| search.threshold_reached | Daily search quota is at 80% |
| search.limit_exceeded | Daily search quota has been exceeded |
| index.completed | Bulk indexing operation finished |
Planned Configuration
Webhooks will be configurable from your dashboard:
- URL - Your endpoint to receive events
- Events - Select which events to subscribe to
- Secret - Signing key for webhook verification
- Retry policy - Automatic retries on failure
Planned Webhook Payload
{
"event": "document.indexed",
"timestamp": "2024-01-15T10:30:00Z",
"site_id": 123,
"data": {
"document_id": "post-456",
"title": "New Blog Post",
"url": "/blog/new-post"
}
}
Planned Verification
Webhooks will include a signature header for verification:
X-SearchJet-Signature: sha256=xxxxxxxxxxxxxxx
Interim Solution: Polling
Until webhooks are available, use polling to detect changes:
import httpx
import time
def poll_for_changes(last_check):
response = httpx.get(
"https://app.searchjetengine.com/v1/search",
params={"q": "*", "filters": f"date>{last_check}", "sort": "date:desc"},
headers={"Authorization": "Bearer sj_srch_xxx"},
)
return response.json()["results"]["hits"]
last_check = "2024-01-15T00:00:00Z"
while True:
changes = poll_for_changes(last_check)
if changes:
print(f"Found {len(changes)} new documents")
time.sleep(300) # Check every 5 minutes
Stay Updated
To be notified when webhooks are available, subscribe to updates at searchjetengine.com or contact support@searchjetengine.com.