Examples
In this guide, we'll show you how to build and deploy a webhook service for receiving event data from Notus API. Whether you're using Node.js or any other programming language, this guide will help you set up a webhook server to seamlessly receive events like swaps or transactions.
We'll walk you through creating a webhook endpoint, validating payloads, and testing your webhook service. By the end, you’ll have a fully functioning webhook server to integrate with Notus API.
Example Webhook Event Payload
Here is an example payload sent by the webhook for a swap event:
Breakdown of Payload Fields
- event: The type of event notification (e.g., notification).
- createdAt: Timestamp when the event occurred.
- payload:
- id: Unique identifier for the event.
- txHash: Transaction hash for the event on the source chain.
- status: Current status of the transaction (e.g., COMPLETED).
- transactionType: Type of transaction (e.g., CROSS_SWAP).
- tokenIn: Token address used in the transaction.
- tokenOut: Token address received in the transaction.
- amountIn: Amount of
tokenIn
involved. - amountOut: Amount of
tokenOut
received. - chainIdIn: Chain ID for the source chain.
- chainIdOut: Chain ID for the destination chain.
- walletAddress: Address of the wallet that initiated the transaction.
- toAddress: Target address for the transaction.
Testing Your Webhook
To test your webhook:
-
Set up the endpoint as shown in the Quickstart.
-
Use tools like Postman or cURL to simulate POST requests to your endpoint with the example payload.
-
Verify that your signature validation works and that your application processes the events correctly.