Advanced Templating

Create a template to filter out event configuration.



We recommend building applications based on the UNIFIED_V1, as outlined in the Events Unified Format page.

Using Predefined Templates

By default, rules use the UNIFIED_V1 template which applies the unified format. There are two predefined templates that can be used:

  • UNIFIED_V1_RAW: This template is the same as UNIFIED_V1 but additionally adds a raw key to the envelope, which contains the raw payload of the message before the UNIFIED_V1 format was applied.
  • ALL_DATA: This template doesn't apply any modifications and will produce messages in their original form.

You can specify the template parameter when creating or updating rules to switch templates.

Using Custom templates

Users can define their templates using Go templates. These templates describe how raw data will be transformed before dispatching to the webhook.

  • If the template field is left blank, all data for the selected event is sent to the webhook as JSON.
  • If provided, the template uses Go templates to render the event.



Please note that the custom templates are applied to raw data, not the unified format.

Request Payload

curl --location '' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer my-token' \
--data '{
    "description": "new template",
    "name": "custom template",
    "template": "{height:{{(default 0 .height) }}}" 

Response Payload

    "created_at": "2024-03-08T18:57:10.719074Z",
    "description": "new template",
    "id": "8547286d-34a5-45c6-8a37-6f09a691a5f0",
    "name": "custom template",
    "template": "{height:{{(default 0 .height) }}}",
    "updated_at": "2024-03-08T18:57:10.719074Z"

➡️ Adding a Template to a Rule

This template can then be referenced in the rule using the template field. Replace <TEMPLATE_ID> with the template ID you've just created.

    "condition": [
            "variable_id": "3c1c1483-d8e0-4ecb-95a0-1e18a5d03244",
            "variable_type": "address"
    "condition_type": "match_var",
    "created_at": "2024-03-06T14:57:10.019668Z",
    "description": "Bitcoin mainnet rule",
    "id": "9e2a6c91-18b1-42a4-864b-b3c4efaa5397",
    "is_active": true,
    "name": "Bitcoin mainnet rule",
    "network": "mainnet",
    "protocol": "bitcoin",
    "safe_distance": 0,
    "safe_timeout": 0,
    "target": "8918a2f1-28d6-4e2f-837b-fb49ec09daaf",
    "template": "<TEMPLATE_ID>",
    "type": "all",
    "updated_at": "2024-03-06T14:57:10.019668Z"

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.