Webhook SDK
The CDP SDK allows you to create webhooks and receive onchain notifications within minutes. In this document, you will learn how to create a webhook, list created webhooks, update a webhook, and delete webhooks.
Our webhooks are in Alpha. Notification delivery is not yet guaranteed.
You can also configure webhooks via CDP Portal.
To learn more about webhook configuration options or event types, please follow this document.
What You’ll Learn
- How to create a webhook
- How to list webhooks
- How to update a webhook
- How to delete a webhook
Prerequisites
Before you get started, please follow this guide to install CDP SDK.
Webhooks on CDP SDK can be created at two levels:
- External Address Webhook: This webhook can be used to track all supported events for any address.
- Wallet Webhook: This webhook can be used to track all supported events all addresses in an API Wallet.
Authenticate
To get started, create a CDP API key and initialize the CDP SDK by passing your downloaded API key file.
You can authenticate with the Platform APIs by calling the configure
method.
This will allow you to authenticate with the Platform APIs.
External Address Webhook
Create
A webhook to track ERC20 transfer events can be created as follows:
Note that eventFilters param currently only supports one filter in the array check the SDK reference for more info on what filters are supported.
You can also create a webhook to track wallet activity as follows:
List
You can view the list of webhooks that you’ve configured.
Update
You can change the notification URI of an external address webhook with the Update method.
Delete
You can remove webhooks that are no longer needed.
Wallet Webhook
You can create a webhook directly for an API Wallet, providing a convenient way to monitor its activities.
When you create a webhook for a wallet:
- It is automatically configured to monitor the wallet’s activities.
- It tracks all supported token types, including ERC20, ERC721, and ERC1155.
- When new addresses are added to the wallet, the webhook automatically starts tracking them as well.
Create
Update
In addition to updating the notification URI, you can modify the list of addresses that a wallet activity webhook is tracking. A common use case is adding new addresses to the monitoring list. Key points to note:
- Updates to the webhook use the PUT method, not PATCH. This means you must provide the complete list of addresses to monitor, including the existing ones, as the update replaces the entire list.
- We cannot update the wallet ID of a wallet activity webhook, however when updating a webhook’s event type filter (where we specify the list of addresses), wallet ID is a required field. You may set it using the wallet ID of the wallet instance.
- Updating a wallet activity webhook is only supported in Python and Node SDK.
Below are examples of how we can append new addresses to the existing list of addresses.