Webhooks
Configure webhooks in Engine to notify your backend server of transaction or backend wallet events.
Supported events
Transactions
Wallets
Setup
Create a webhook
- Visit the Engine dashboard.
- Select the Configuration tab.
- Select Create Webhook.
Webhook URLs must start with https://
.
However http://localhost:*
is allowed for local testing.
Backend wallet balance
Define the minWalletBalance
(in the blockchain native coin) to maintain in each backend wallet. The default value is value is 2000000000000000 wei
(e.g. 0.002 ETH). A webhook event will be sent if a backend wallet balance falls below this value.
To read or update this value, call GET/POST /configuration/backend-wallet-balance
.
Transaction events
Create a webhook by calling POST /webhooks/create
.
Webhook verification
To secure your webhook endpoint, verify the request originated from Engine.
Check the signature
The payload body is signed with the webhook secret and provided in the X-Engine-Signature
request header.
This code example checks if the signature is valid:
Check the timestamp
The event timestamp is provided in the X-Engine-Timestamp
request header.
This code example checks if the event exceeds a given expiration duration:
Example webhook endpoint
This NodeJS code example listens for event notifications on the /webhook
endpoint:
Payload format
The webhook request to your backend follows this format.
Method: POST
Headers:
Content-Type
:application/json
X-Engine-Signature
: <payload signature>X-Engine-Timestamp
: <Unix timestamp in seconds>