Skip to main content

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: Stream rules menu item

Creating a New Rule

To create a rule from the Stream Rules console, take the following steps:

  1. Click the Create button from the main rules view
  2. Select the type of rule you wish to create (Token mints, Contract calls, etc.)
  3. After selecting a type of rule, fill out the required fields for that rule.
  4. Click the Create button to complete creation of the rule

When creating a rule, the following fields can be provided:

FieldDescription
Predicate valueThe 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
NameA name to give to the rule. This might be useful to identify the purpose of a rule
NetworkWhich network should this rule be created for?
Webhook URLThe target destination where matching events will be sent
Custom header propertiesProperties that will be sent as request headers for webhook notifications. This allows performing API-key authentication, adding custom metadata, etc. to notifications
Batch OptionsEnabling 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.