You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add webhooks section to agents and LLMs documentation (#7317)
# [Portal] Feature: Add Webhooks Documentation for AI Agents + Example with multiple ABIs for decoding
## Notes for the reviewer
Example with multiple ABIs for decoding ([related PR](https://app.graphite.dev/github/pr/thirdweb-dev/insight-service/268/fix-improve-ABI-validation-to-support-array-format))
1. Added examples on creating events filters with multiple ABI options
Also, this PR adds comprehensive documentation about using webhooks with AI agents in the Insight platform. The documentation covers:
1. Use cases for webhooks with AI agents
2. How to create and manage webhooks
3. Filtering capabilities, including support for multiple ABIs
4. Information about webhook payloads
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Documentation**
- Added a new "Webhooks" section describing how to use webhooks with the Insight API for real-time blockchain event notifications and event-driven AI agents.
- Provided use cases, filter examples, and links to detailed webhook and payload documentation.
- Enhanced webhook filter documentation to clarify support for multiple ABIs, including examples for handling ERC-20 and ERC-721 Transfer events.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy file name to clipboardExpand all lines: apps/portal/src/app/insight/agents-and-llms/llmstxt/page.mdx
+40Lines changed: 40 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -319,6 +319,46 @@ async function safeApiCall() {
319
319
}
320
320
```
321
321
322
+
## Webhooks
323
+
324
+
Webhooks allow you to receive notifications when specific blockchain events or transactions occur. This enables you to build event-driven AI agents that can react to on-chain activity in real-time.
325
+
326
+
### Use Cases for AI Agents
327
+
328
+
-**Real-time Monitoring**: An agent can monitor for specific events (e.g., a large transfer to a whale wallet) and trigger alerts or other actions.
329
+
-**Automated Workflows**: When a specific on-chain action occurs (e.g., a new NFT is minted), an agent can automatically kick off a downstream process, like updating a database or sending a notification.
330
+
-**Data Aggregation**: Use webhooks to feed on-chain data into a vector database or other data store for later analysis by an LLM.
331
+
332
+
### Creating a Webhook
333
+
334
+
Webhooks are created and managed via the Insight API. You can find more details in the [Managing Webhooks documentation](/insight/webhooks/managing-webhooks).
335
+
336
+
### Filtering
337
+
338
+
You can create powerful filters to specify exactly which events or transactions you want to be notified about.
339
+
340
+
For example, to receive a notification for both ERC-20 and ERC-721 `Transfer` events, you can use a filter like this:
This allows an agent to monitor multiple token standards with a single webhook. For more on filtering, see the [Filtering documentation](/insight/webhooks/filtering).
357
+
358
+
### Payload
359
+
360
+
The webhook payload contains the event or transaction data. Your agent will need to parse this payload to extract the relevant information. See the [Payload documentation](/insight/webhooks/payload) for details on the payload structure.
Copy file name to clipboardExpand all lines: apps/portal/src/app/insight/agents-and-llms/page.mdx
+38Lines changed: 38 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -342,6 +342,44 @@ async function safeApiCall() {
342
342
}
343
343
```
344
344
345
+
## Webhooks
346
+
347
+
Webhooks are a powerful tool for building event-driven AI agents that can react to on-chain activity in real-time. By subscribing to specific blockchain events or transactions, your agent can receive notifications and trigger automated workflows.
348
+
349
+
### Use Cases for AI Agents
350
+
351
+
- **Real-time Monitoring**: An agent can monitor for specific events (e.g., a large transfer to a whale wallet) and trigger alerts or other actions.
352
+
- **Automated Workflows**: When a specific on-chain action occurs (e.g., a new NFT is minted), an agent can automatically kick off a downstream process, like updating a database or sending a notification.
353
+
- **Data Aggregation**: Use webhooks to feed on-chain data into a vector database or other data store for later analysis by an LLM.
354
+
355
+
### Getting Started with Webhooks
356
+
357
+
To get started, you can create and manage webhooks through the Insight API. For detailed instructions, refer to the [Managing Webhooks documentation](/insight/webhooks/managing-webhooks).
358
+
359
+
### Filtering Events
360
+
361
+
Insight's webhooks feature a powerful filtering system that lets you subscribe to only the events and transactions you care about. For example, you can create a single webhook that notifies your agent of both ERC-20 and ERC-721 `Transfer` events by providing multiple ABIs in the filter.
For more advanced filtering options, see the [Filtering documentation](/insight/webhooks/filtering).
378
+
379
+
### Understanding the Payload
380
+
381
+
When a webhook is triggered, it sends a payload to your specified endpoint. This payload contains the event or transaction data that your agent will need to process. To learn more about the structure of this payload, see the [Payload documentation](/insight/webhooks/payload).
Copy file name to clipboardExpand all lines: apps/portal/src/app/insight/webhooks/filtering/page.mdx
+41-13Lines changed: 41 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -30,12 +30,12 @@ Each webhook must have either an events filter or a transactions filter (or both
30
30
```typescript
31
31
{
32
32
"v1.events": {
33
-
chain_ids: string[], // Filter by specific chains
34
-
addresses: string[], // Filter by contract addresses
35
-
signatures: { // Filter by event signatures
36
-
sig_hash: string, // Event signature hash
37
-
abi?: string, // OptionalABI for data decoding
38
-
params?: Record<string, string | number> // Filter on decoded parameters
33
+
chain_ids: string[], // Filter by specific chains
34
+
addresses: string[], // Filter by contract addresses
35
+
signatures: { // Filter by event signatures
36
+
sig_hash: string, // Event signature hash
37
+
abi?: string, // Optional: A single ABI object or an array of ABI objects as a string for data decoding
38
+
params?: Record<string, string | number> // Filter on decoded parameters
39
39
}[]
40
40
}
41
41
}
@@ -45,13 +45,13 @@ Each webhook must have either an events filter or a transactions filter (or both
45
45
```typescript
46
46
{
47
47
"v1.transactions": {
48
-
chain_ids: string[], // Filter by specific chains
49
-
from_addresses: string[], // Filter by sender addresses
50
-
to_addresses: string[], // Filter by recipient addresses
51
-
signatures: { // Filter by function signatures
52
-
sig_hash: string, // Function signature hash
53
-
abi?: string, // OptionalABI for data decoding
54
-
params?: Record<string, string | number> // Filter on decoded parameters
48
+
chain_ids: string[], // Filter by specific chains
49
+
from_addresses: string[], // Filter by sender addresses
50
+
to_addresses: string[], // Filter by recipient addresses
51
+
signatures: { // Filter by function signatures
52
+
sig_hash: string, // Function signature hash
53
+
abi?: string, // Optional: A single ABI object or an array of ABI objects as a string for data decoding
54
+
params?: Record<string, string | number> // Filter on decoded parameters
55
55
}[]
56
56
}
57
57
}
@@ -82,6 +82,34 @@ The following example will filter for `Transfer` events on Ethereum for the cont
82
82
}
83
83
```
84
84
85
+
### Supporting Multiple Event ABIs
86
+
87
+
In some cases, different token standards use the same event signature. For example, both ERC-20 and ERC-721 standards have a `Transfer` event. The ERC-20 `Transfer(address,address,uint256)` event has a non-indexed `value` parameter, while the ERC-721 `Transfer(address,address,uint256)` has an indexed `tokenId` parameter.
88
+
89
+
To support these scenarios, you can provide an array of ABIs in the `abi` field. This allows the webhook to attempt decoding with each ABI until one succeeds.
90
+
91
+
The `abi` field accepts a string that can be either a single JSON object `"{}"` or a JSON array of objects `'[{},{}]'`.
92
+
93
+
Here is an example of a webhook that filters for both ERC-20 and ERC-721 `Transfer` events across all contracts on the Ethereum mainnet:
0 commit comments