Inverse Watch Docs
AppLanding
  • Overview
    • Home
    • Governance
      • Proposal 7
      • Proposal 25
      • Proposal 52
      • Proposal 107
      • Proposal 147 - S1
      • Proposal 189 - S2
  • Products
    • Inverse Alerts
      • See on Twitter
    • Inverse Chatbot
      • /doc
      • /imagine
      • /data
      • /graph
    • Inverse Subgraphs
      • See inverse-subgraph on Mainnet
      • See inverse-governance-subgraph on Mainnet
    • Inverse Watch
      • Go to App
  • User Guide
    • Quickstart
    • Alerts
      • Setting Up an Alert
      • Adding New Alert Destinations
      • Customize Alert Template
      • Multiple Column Alert
    • Queries
      • Creating and Editing Queries
      • Querying Existing Query Results
      • Query Parameters
      • How to Schedule a Query
      • Favorites & Tagging
      • Query Filters
      • How To Download / Export Query Results
      • Query Snippets
    • Visualizations
      • Cohort Visualizations
      • Visualizations How-To
      • Chart Visualizations
      • Formatting Numbers in Visualizations
      • How to Make a Pivot Table
      • Funnel Visualizations
      • Table Visualization Options
      • Visualizations Types
    • Dashboards
      • Creating and Editing Dashboards
      • Favorites & Tagging
      • Sharing and Embedding Dashboards
    • Data Sources
      • CSV & Excel Files
      • Google Sheets
      • JSON (API)
      • Python
      • EVM Chain Logs
      • EVM Chain State
      • GraphQL
      • Dune API
    • Machine Learning
      • Data Engineering
      • Regressors
        • Linear Regression
        • Random Forest
        • Ada Boosting
        • Gradient Boosting
        • Neural Network (LSTM)
      • Training and Predicting
      • Metrics & Overfitting
      • Examples
        • Price Prediction
          • Data Preprocessing
          • Model Creation & Training
          • Metrics Evaluation
          • Back Testing
          • Visualizing
        • Liquidation Risk
  • Admin & Dev Guide
    • Setup
    • Redash
    • Integrations & API
    • Query Runners
    • Users
      • Adding a Profile Picture
      • Authentication Options
      • Group Management
      • Inviting Users to Use Redash
      • Permissions & Groups
    • Visualizations
  • Cheat Sheets
    • Snippets
    • Contracts
  • More
    • Deprecated Apps
    • Github : inverse-flaskbot
    • Github : inverse-subgraph
    • Github : inverse-watch
Powered by GitBook
On this page

Was this helpful?

  1. User Guide
  2. Alerts

Customize Alert Template

PreviousAdding New Alert DestinationsNextMultiple Column Alert

Last updated 7 months ago

Was this helpful?

The application alerts can notify you when your queries match some arbitrary criteria.

Next to the setting labeled “Template”, click the dropdown and select “Custom template”. A box will appear, consisting of input fields for subject and body.

Any static content is valid, and you can also incorporate some built-in template variables:

  • ALERT_NAME - The alert name (string).

  • ALERT_URL - The alert page url (string).

  • QUERY_NAME - The correlated query name (string).

  • QUERY_URL - The correlated query page url (string).

  • QUERY_RESULT_VALUE - The query result value (string or number).

  • QUERY_RESULT_ROWS - The query result rows (value array).

  • QUERY_RESULT_COLS - The query result columns (string array).

  • QUERY_RESULT_TABLE - Query results formatted as two dimensional array of values.

An example subject, for instance, could be: Alert "{{ALERT_NAME}}" changed status to {{ALERT_STATUS}}

Click the “Preview” toggle button to preview the rendered result and save your changes by clicking the “Save” button.

The preview is useful for verifying that template variables get rendered correctly. It is not an accurate representation of the eventual notification content, as each alert destinations can display notifications differently.

The preview is useful for verifying that template variables get rendered correctly. It is not an accurate representation of the eventual notification content, as each alert destinations can display notifications differently.

To return to the default the application message templates, re-select “Default template” at any time.

Examples of two types of customized templates you can provide:

Text-Based Template:

  • This type uses placeholders within a string to represent real-time data.

  • Placeholders are enclosed in double curly braces: {{ }}.

  • Use dot notation to access list items (e.g., {{symbol.0}} for the first item).

  • Formatting options (like .2% or :,.2f) can be appended to variables to display values in specific formats.

When using "Each time alert is evaluated for each row in the result", you don't need to specify the row (e.g., {{symbol}} for the item).

JSON-Based Template:

  • This type employs the JSON format, offering a more structured and rich content presentation.

  • Key Elements:

    • content: A string where you can place general content.

    • embeds: An array that can contain multiple embed objects. Each embed object can have:

      • title: The main heading of the embed.

      • color: A numerical value representing the color of the embed line in decimal format.

      • image: An object with a URL for the image to display.

      • fields: An array of objects, where each object represents a piece of data to display. Each field can have:

        • name: The name or label for the data.

        • value: The value of the data, with placeholders (like {{block_link}}).

        • inline: A boolean (true or false) indicating if the field should be displayed inline with others.

By understanding these elements, you can effectively customize alert templates in the application to suit your specific needs. Remember to always test your templates to ensure they display as expected when triggered.

Let's have a look at this example, using "Each time alert is evaluated for each row in the result" notification type

If we use this query:

We can write this custom template for our alert:

here's how the columns map to the template:

  • block: Reflected in the template as {{block_link.2}} which is a hyperlink to the block on Etherscan, referring to the third row of "block_link" column.

  • timestamp: Appears in the template as {{timestamp.2}} and will display the timestamp of the event, referring to the third row of "timestamp" column.

  • amount: Appears as {{amount.1:,.2f}} DOLA in the template. The format :,.2f indicates that the amount will be displayed with two decimal places and commas as thousand separators, followed by the word "DOLA". .1refers to the second row of "amount" column.

  • transaction_hash: Reflected as {{transaction_hash_link.0}} in the template, which is a hyperlink to the specific transaction on Etherscan. .0 refers to the first row of "transaction_hash_link" column.

Now if we want to use another notification type such as "Each time alert is evaluated until back to normal" and specify a particular row from the query result in the template, we can write this custom template:

{
   "content":"",
   "embeds":[
      {
         "title":"Debt Converter : Redemption detected",
         "color":78368,
         "image":{
            "url":""
         },
         "fields":[
            {
               "name":"Block",
               "value":"{{block_link.2}}",  // Referring to the third row's block link
               "inline":false
            },
            {
               "name":"Timestamp",
               "value":"{{timestamp.2}}",  // Referring to the third row's timestamp
               "inline":false
            },
            {
               "name":"Amount",
               "value":"{{amount.1:,.2f}} DOLA",  // Referring to the third row's amount
               "inline":false
            },
            {
               "name":"Transaction",
               "value":"{{transaction_hash_link.0}}",  // Referring to the third row's transaction link
               "inline":false
            }
         ]
      }
   ]
}

If you wish to modify an alert, click the “Edit” button at the top of the alert page.

ALERT_STATUS - The evaluated (string).

ALERT_CONDITION - The alert (string).

ALERT_THRESHOLD - The alert (string or number).

alert status
condition operator
threshold