# 告警通知模板

### 什么是告警通知模板？

ChainBot 平台中，告警通知模板本质为一串字符串，没有长度限制。每当用户创建 Bot 时，都会生成一个默认的告警通知模板，用户需要根据自身需求，变更告警通知模板中的关键词，同时可以根据每种 Bot 监控类型变更注入变量。

以下为告警通知模板示例：

```
[ {$bot.name} ]
  Contract: {$event.contract}
  Time: {$block.time}
  Explore: {$chain.explore}/tx/{$tx.hash}
  Created By ChainBot.io
```

其中例如 “Contract” 为方便用户阅读的关键词，“{$event.contract}” 为模板变量。其中模板变量必须使用 "{}" 包括起来。

[了解不同 Bot 监控支持的注入变量？](/zh/advanced-features/alarm-notification-template/message-template.md)

### 告警通知模板高级功能

> 使用该部分功能，用户需要有初级的编程技能。

#### 1. 格式化时间

```javascript
// 格式化时区至用户设定的时区
timezone($block.time, 8)
```

#### 2. 四则运算

```javascript
"123000000000000000000" / 1e18 == 123
"1" + "1" + 1 == 3
2 - 1 == 1
2 * 2 == 4
```

#### 3. 取整运算

```
{ round(1000000000001000000 / 1e18, 1)}
```

#### 复杂告警模板示例

```
[{$subscription.name}]
Block: {$block.number}
Values: {$values._reserve0 / 1e18} / {$values._reserve1 / 1e18} = {$values.percent}
Condition: {$condition}
Time: {$block.time}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chainbot.io/zh/advanced-features/alarm-notification-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
