Webhooks
Webhooks allow your system to receive real-time notifications from Kepler when specific events occur on the blockchain. This page details how to configure filters, process payloads, and verify the sec
Event Filtering Options
When configuring a webhook, you can filter which events trigger a notification. You can use a combination of three criteria.
βΉοΈ Note If multiple filters are set, all conditions must match (AND logic) for the webhook to be triggered. If you set both an
addressand anidentifier, only events matching both will trigger the webhook.
address
The smart contract address that emitted the event. Must be an exact match.
erd1qqqq...
identifier
The event identifier/name. Must be an exact match.
transfer, swap
topic
The first topic of the event (decoded from base64). Must be an exact match.
claimed
Configuration Rules
Requirement: At least one filter (
address,identifier, ortopic) is mandatory.Decoding: Topics in MultiversX events are base64-encoded. The filter matches against the decoded value of the first topic.
Common Examples
address: erd1qqq...abc
Receives all events from this specific address.
identifier: transfer
Receives all transfer events from any address.
address: erd1qqq...abc
identifier: distribute
Receives only distribute events from the specific address.
Webhook Delivery
When an event matches your filters, Kepler sends an HTTP POST request to your configured URL.
The Payload
The request body is a JSON object containing the event details and a timestamp.
Markdown
Field
Type
Description
event.address
string
The smart contract address that emitted the event.
event.identifier
string
The event identifier/name.
event.topics
string[]
Array of base64-encoded topics.
event.data
string
Base64-encoded event data (may be empty).
event.txHash
string
The transaction hash that triggered the event.
timestamp
number
Unix timestamp (seconds) of webhook dispatch.
webhook
string
Your webhook's unique identifier.
Headers
Header
Value
Description
Content-Type
application/json
The media type of the body.
X-Signature
Hex-string
Important: The cryptographic signature for verification.
User-Agent
ProjectX-Kepler/{version}
Identifies the sender.
Delivery Lifecycle
Expected Response
Your endpoint must return a status code in the 2xx range (e.g., 200 OK) to acknowledge receipt. The response body is ignored.
β οΈ Warning
Your server must respond within 10 seconds. If the request times out, it is treated as a failure and will be retried.
Retry Mechanism
If delivery fails (network error, timeout, or non-2xx status), Kepler retries automatically.
Max Retries: 3 attempts (4 total requests).
Strategy: Progressive backoff (5s, 10s, 15s).
Example Timeline:
T+0s: Initial attempt (Fails)T+5s: Retry 1 (Fails)T+15s: Retry 2 (Fails)T+30s: Final Retry
Security & Verification
To ensure requests originate from Kepler and haven't been tampered with, you must verify the X-Signature header.
Verification Logic
Serialize: Read the raw request body as a string.
Verify: Use the MultiversX message signing algorithm (Ed25519) to verify the body against the signature.
Public Key: Use the official Kepler signing address below.
Kepler Public Signing Address:
Plaintext
Code Examples
TypeScript / JavaScript
Python
Best Practices
Idempotency: In rare network conditions, you may receive the same webhook twice. Always use the
event.txHashas a unique key to prevent processing the same event multiple times.Async Processing: Return a
200 OKimmediately, then process the data asynchronously (e.g., send it to a queue). This prevents timeouts.Security: Always use HTTPS. Validate the
timestampfield (e.g., ensure it is within the last 5 minutes) to prevent replay attacks.
Quick Start: Receive Your First Webhook
Follow this guide to set up a local webhook receiver, expose it to the internet, and trigger a test event from Kepler.
Prerequisites
A Kepler account.
Node.js installed on your machine.
A tool to tunnel local ports to the internet (e.g., ngrok).
Step 1: Create a Simple Receiver
Create a file named server.js and paste the following code. This sets up a basic Express server that logs incoming webhooks to your console.
Install dependencies and start the server:
Bash
Step 2: Expose Your Server
Since Kepler cannot reach your localhost directly, use a tunneling service to create a public URL.
Bash
Copy the HTTPS URL generated by ngrok (e.g., https://a1b2-c3d4.ngrok-free.app). Your full webhook URL will be: https://a1b2-c3d4.ngrok-free.app/webhook
Step 3: Configure Kepler
Log in to your Kepler dashboard and navigate to Webhooks.
Click Create Webhook.
URL: Paste your ngrok URL (ensure it ends with
/webhook).Filters: Set up a filter to reduce noise. For testing, you might want to track a common token transfer.
Identifier:
transfer(Leave Address and Topic empty to catch all transfers for now)
βΉοΈ Tip Start with broad filters (like just an
identifier) to ensure your connection works, then narrow them down with specificaddressortopicfilters later.
Step 4: Test and Verify
Trigger an action on the blockchain (or wait for a live event that matches your filter).
Check your terminal running
server.js. You should see:
Plaintext
Check the Kepler dashboard. The webhook status should show 200 OK.
What's Next?
Now that you are receiving events:
Secure your endpoint: Implement Signature Verification.
Handle logic: Parse the
topicsarray to decode transfer amounts and recipients.Go to production: Deploy your Node.js script to a cloud provider (AWS, Heroku, DigitalOcean).
Last updated