What are webhooks?
Webhooks let your backend receive real-time updates whenever data changes in your subgraph, for example, when an entity is inserted, updated, or deleted. This is useful for:- Triggering external workflows.
- Syncing your database with on-chain data.
- Integrating subgraph evenets into other systems or services.
How it works
Whenever a subgraph handler runsentity.save(), or removes an entity, the change is recorded. A real-time watcher detects the event and sends an HTTP POST request to your configured webhook endpoint.
Payload includes:
- Operation type:
INSERT,UPDATE, orDELETE - Entity name: the affected entity (ex.
approved,user,pool) - Entity data: The new or updated values
- Timestamp and block number
Creating a Webhook
You can create a new webhook through the 0xGraph dashboard.
- Navigate to the Webhooks tab of your subgraph.
- Click on the Add Webhook button.

Parameters of each field
- Name: A descriptive name for your webhook (e.g.,
webhook_demo). - URL: The HTTP endpoint where the webhook payloads will be sent.
- Entity: The specific entity you want to track (ex.,
approved). - Number of retries: Configure the total number of retries. Defaults to 3, with a maximum of 10.
- Retry interval: Configure the retry interval in seconds. Defaults to 60, with a maximum of 3600.
- Retry timeout: Configure the retry timeout in seconds. Defaults to 30, with a maximum of 60.
- “secret” header value: An optional secret string that will be sent in a designated webhook secret header. This allows your endpoint to verify that the request is authentic.
- Fill in the required fields in the Create Webhook pop-up.
- Click Create.
Viewing and managing webhooks
All created webhooks appear in your subgraph’s Webhooks list.
- The tracked entity and target URL.
- Last delivery time.
- Number of successful and failed deliveries.
- Retry and error statistics.
Webhook payload structure
The webhook will send a JSON payload to your configured URL. The main payload object contains the following fields:op(string): The type of operation that triggered the webhook. Possible values are"INSERT","UPDATE", or"DELETE".data_source(string): Identifier for the subgraph or indexer being tracked.data(object): Contains the actual entity data that changed. It has two sub-fields:old(object | null): The state of the entity before the change. This will benullif theopis"INSERT".new(object | null): The state of the entity after the change. This will benullif theopis"DELETE".
webhook_name(string): The name you assigned to your webhook during creation.webhook_id(string): A unique identifier for the webhook configuration.id(string): A unique identifier for this specific event notification.delivery_info(object): Information about the delivery attempt for this webhook. It has two sub-fields:max_retries(integer): The maximum number of retry attempts configured for this webhook.current_retry(integer): The current retry attempt number for this specific event (0 for the initial attempt).
entity(string): The name of the subgraph entity being tracked.
Example Payloads:
INSERT operation:
UPDATE operation :