Appearance
Transaction webhooks
INFO
Webhooks for server wallets are not yet live in production. This guide is intended to be a preview of upcoming functionality.
Privy emits webhooks whenever the status of a transaction sent by a server wallet changes. This helps your application track the status of the transaction after it has been broadcasted to the network, and be notified when the transaction is confirmed or reverts.
To set up transaction webhooks, follow the guide below.
Events
Privy allows you to subscribe to webhooks on the following transaction events: 'broadcasted'
, 'confirmed'
, 'execution_reverted'
:
'broadcasted'
refers to when a transaction has been submitted to the network but has not yet been included in a block'confirmed'
refers to when a transaction has been included in at least one block that has been confirmed on the network. You can additionally configure Privy to wait for more than one block confirmation before updating a transaction's status to'confirmed'
.'execution_reverted'
refers to when a transaction has reverted in execution.
Setup
To start, go to the Webhooks page for your app in the Privy Dashboard and provide a destination URL for receiving webhooks.
Then, enable the 'transaction.broadcasted'
, 'transaction.confirmed'
, and/or 'transaction.execution_reverted'
events depending on the transaction events you'd like to be notified of.
Privy will emit a signed webhook to this URL whenever transaction status updates, and will retry delivery if the endpoint does not successfully respond to the original webhook.
Payload
When the status of a transaction updates, Privy will emit a webhooks payload with the following fields:
Field | Type | Description |
---|---|---|
event | 'transaction.{broadcasted, confirmed, reverted}' | Event for the transaction. |
transaction_id | string | ID for the transaction. |
wallet_id | string | ID of the server wallet that sent the transaction. |
transaction_hash | string | Hash for the transaction. |
caip2 | string | CAIP-2 chain ID of the network that the transaction was broadcasted on. |
Example
Below is a sample webhooks payload that Privy will send on a 'transaction.confirmed'
event.
json
{
"event": "transaction.confirmed",
"transaction_id": "fmfdj6yqly31huorjqzq38zc",
"wallet_id": "cm4db8x9t000ccn87pctvcg9j",
"transaction_hash": "0x2446f1fd773fbb9f080e674b60c6a033c7ed7427b8b9413cf28a2a4a6da9b56c",
"chain_id": "eip155:8453"
}