Create Rules
Stream Rules & events can be created and managed in two main ways:
The Streams API
To use our Stream Rules API, all you need is an API token. See Create API Token. The token should be passed in the Authorization
header of requests to the Stream Rules API. See Using Your API Token for examples.
We currently have Hedera mainnet and testnet APIs. See our API documentation for more details on available endpoints and usage:
The Customer Portal
From the Ledger Works customer portal, you can:
- view all rules associated with your account
- create, edit, & delete rules
- view an audit trail of notifications created by each rule
This is the recommended way to get started using Stream Rules and managing a small set of rules.
To access the Stream Rules management console, click on the Stream Rules menu item:
Creating a New Rule
To create a rule from the Stream Rules console, take the following steps:
- Click the Create button from the main rules view
- Select the type of rule you wish to create (Token mints, Contract calls, etc.)
- After selecting a type of rule, fill out the required fields for that rule.
- Click the Create button to complete creation of the rule
When creating a rule, the following fields can be provided:
Field | Description |
---|---|
Predicate value | The actual name of this field changes between rule types (e.g., Token ID , Topic ID , etc.). However, all rules require an ID to target important events on ledger |
Name | A name to give to the rule. This might be useful to identify the purpose of a rule |
Network | Which network should this rule be created for? |
Webhook URL | The target destination where matching events will be sent |
Custom header properties | Properties that will be sent as request headers for webhook notifications. This allows performing API-key authentication, adding custom metadata, etc. to notifications |
Batch Options | Enabling batch options directs Stream Rules to batch notifications. Stream Rules batches notifications that are close together in time using a session window strategy. You must specify the max number of notifications per webhook. Currently the max is 100 items per webhook. |