You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Alarm management API
CreateAlarmContentTemplate
Copy page
Download PDF
CreateAlarmContentTemplate
Call the CreateAlarmContentTemplate API to create an alarm notification content template.​
Notes​
The call frequency limit for this API is 20 times per second. If the frequency limit is exceeded, an ExceedQPSLimit error will be returned.​
Note​
  • Request method: POST​
  • Request URL: https://{tls-endpoint}/CreateAlarmContentTemplate​
Request parameters​
The following table lists only the request parameters unique to this interface and some common parameters. For more information, see Public parameters.​
Body​
​
Parameter​
Type​
Required​
Example value​
Description​
AlarmContentTemplateName​
String​
Is​
test-alarm-content-template​
The name of the alarm notification content template. For naming rules, please refer to Resource naming rules.​
DingTalk​
No​
/​
The DingTalk notification content template.​
Email​
No​
/​
The email notification content template.​
Lark​
No​
/​
A Feishu notification content template.​
NeedValidContent​
Boolean​
No​
true​
Is it necessary to validate the content template?​
Sms​
No​
/​
SMS notification content template.​
Vms​
No​
/​
Voice notification content templates.​
WeChat​
No​
/​
WeCom notification content template.​
Webhook​
No​
/​
A custom Webhook alert notification content template.​
​
DingTalkContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Title​
String​
No​
Alert notification​
The subject of the alert notification.​
Locale​
String​
No​
zh-CN​
The language of fixed content in alert notifications. Optional values are zh-CN and en-US.​
Content​
String​
No​
Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nAlarm level:{{Severity}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service​
The alarm notification content supports the plain text format and allows the insertion of content variables, content functions, and more. For detailed explanations, please refer to content variables and content functions.​
tip​
The maximum length of notification content after variable rendering is 8 KB. Content that exceeds this limit will be truncated.​
Leaving the main text blank indicates that the default content will be used.​
​
EmailContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Locale​
String​
No​
zh-CN​
The language of fixed content in alert notifications. Optional values are zh-CN and en-US.​
Content​
String​
No​
​
Alarm Policy:{{Alarm}}<br> ​
Alarm project:{{ProjectName}}<br> ​
Alarm topic:{{AlarmTopicName}}<br> ​
Alarm level:{{Severity}}<br> ​
First Trigger time:{{StartTime}}<br> ​
Triggering conditions:{{Condition}}<br> ​
notification type:{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%} <br> ​
Alarm duration:{{Duration}}<br> ​
Additional Notification content:{{NotifyMsg}}​
​
Alarm notification content supports plain text format and allows the insertion of content variables, content functions, and more. For detailed explanations, please refer to content variables and content functions.​
tip​
The maximum length of notification content after variable rendering is 8 KB. Content that exceeds this limit will be truncated.​
Leave the main text blank to use the default content.​
Subject​
String​
No​
Alert notification​
The email notification subject.​
​
LarkContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Title​
String​
No​
Alert notification​
The subject of the alert notification.​
Locale​
String​
No​
zh-CN​
The language of fixed content in alert notifications. The available values are zh-CN and en-US.​
Content​
String​
No​
Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nAlarm level:{{Severity}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service​
Alarm notification content supports plain text format and allows insertion of content variables, content functions, and more. For detailed explanations, please refer to content variables and content functions.​
tip​
The maximum length of notification content after variable rendering is 8 KB. If the content exceeds this limit, it will be truncated.​
Leave the main text blank to use the default content.​
​
SmsContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Locale​
String​
No​
zh-CN​
The language of fixed content in alert notifications. Available values are zh-CN and en-US.​
Content​
String​
No​
Alarm Policy{{Alarm}}, Alarm project:{{ProjectName}}, Alarm topic:{{AlarmTopicName}}, Alarm level:{{Severity}}, notification type:{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%},First Trigger time:{{StartTime}}, Triggering conditions:{{Condition}}, Current query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}],Additional Notification content:{{NotifyMsg}}​
Alarm notification content supports plain text format and supports inserting content variables, content functions, and more. For a detailed explanation, refer to content variables and content functions.​
tip​
  • It is recommended to keep the length of notification content after variables are rendered within 256 characters, as content exceeding this limit may be truncated.​
  • Leaving the main text blank indicates that the default content will be used.​
​
VmsContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Locale​
String​
No​
zh-CN​
The language of fixed content in alarm notifications. Optional values are zh-CN and en-US.​
Content​
String​
No​
Notification type: {%if NotifyType==1%}Alarm triggered{%else%}Alarm resolved{%endif%}​
Alarm notification content supports plain text format and allows insertion of content variables, content functions, and more. For a detailed explanation, please refer to content variables and content functions.​
tip​
  • It is recommended to keep the length of the notification content after variable rendering within 256 characters; content that exceeds this limit may be truncated.​
  • If the main text is left blank, the default content will be used.​
​
WeChatContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Title​
String​
No​
Alert notification​
The subject of the alarm notification.​
Locale​
String​
No​
zh-CN​
The language of fixed content in alert notifications. Available values are zh-CN and en-US.​
Content​
String​
No​
Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nAlarm level:{{Severity}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service​
Alarm notification content supports plain text format and supports insertion of content variables, content functions, and more. For detailed instructions, refer to content variables and content functions.​
tip​
The maximum length of notification content after variable rendering is 8 KB. Content that exceeds this limit will be truncated. Leaving the main text blank indicates that the default content will be used.​
​
WebhookContentTemplateInfo​
​
Parameter​
Type​
Required​
Example value​
Description​
Content​
String​
No​
​
{​
"msg_type": "interactive",​
"card": {​
"config": {​
"wide_screen_mode": true​
},​
"elements": [​
{​
"content": "Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service",​
"tag": "markdown"​
}​
],​
"header": {​
"template": "{%if NotifyType==1%}red{%else%}green{%endif%}",​
"title": {​
"content": "【Torch Log Service】【Log Service】{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}",​
"tag": "plain_text"​
}​
}​
}​
}​
​
Alert notification content is usually in JSON format and supports inserting content variables, content functions, and so on. For detailed information, refer to content variables and content functions.​
tip​
The maximum length of notification content after variable rendering is 16 KB. Content that exceeds this limit will be truncated. Leaving the main body empty indicates that default content will be used.​
​
Return parameters​
The table below lists only the return parameters unique to this interface. For more information, see Return structure.​
​
Parameter​
Type​
Example value​
Description​
AlarmContentTemplateId​
String​
5972a31a****​
Alarm notification template ID.​
​
Request example​
​
POST https://{tls-endpoint}/CreateAlarmContentTemplate HTTP/1.1​
Content-Type: application/json​
{​
"AlarmContentTemplateName": "test",​
"DingTalk": {​
"Content": "Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nAlarm level:{{Severity}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service",​
"Title": "TLS Alarm",​
"Locale": "zh-CN"​
},​
"Email": {​
"Content": "Alarm Policy:{{Alarm}}<br> ​
Alarm project:{{ProjectName}}<br> ​
Alarm topic:{{AlarmTopicName}}<br> ​
Alarm level:{{Severity}}<br> ​
First Trigger time:{{StartTime}}<br> ​
Triggering conditions:{{Condition}}<br> ​
notification type:{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%} <br> ​
Alarm duration:{{Duration}}<br> ​
Additional Notification content:{{NotifyMsg}}",​
"Subject": "TLS Alarm",​
"Locale": "zh-CN"​
},​
"Lark": {​
"Content": "Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nAlarm level:{{Severity}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service",​
"Title": "TLS Alarm",​
"Locale": "zh-CN"​
},​
"WeChat": {​
"Content": "Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nAlarm level:{{Severity}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service",​
"Title": "TLS Alarm",​
"Locale": "zh-CN"​
},​
"Webhook": {​
"Content": "{\n \"msg_type\": \"interactive\",\n \"card\": {\n \"config\": {\n \"wide_screen_mode\": true\n },\n \"elements\": [\n {\n \"content\": \"Dear users, Hello!\nYour account (Master Account ID:{{AccountID}} )of log service{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\nAlarm Policy:{{Alarm}}\nAlarm topic:{{AlarmTopicName}}\nFirst Trigger time:{{StartTime}}\nTriggering conditions:{{Condition}}\nCurrent query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}];\nAdditional Notification content:{{NotifyMsg|escapejs}}\n\nThanks for supporting Torch Log Service\",\n \"tag\": \"markdown\"\n }\n ],\n \"header\": {\n \"template\": \"{%if NotifyType==1%}red{%else%}green{%endif%}\",\n \"title\": {\n \"content\": \"【Torch Log Service】【Log Service】{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%}\",\n \"tag\": \"plain_text\"\n }\n }\n }\n}"​
},​
"Vms": {​
"Content": "Notification Type:{%if NotifyType==1%}Triggering an alarm{%else%}Alarm recovery{%endif%}",​
"Locale": "zh-CN"​
},​
"Sms": {​
"Content": "Alarm Policy{{Alarm}}, Alarm project:{{ProjectName}}, Alarm topic:{{AlarmTopicName}}, Alarm level:{{Severity}}, notification type:{%if NotifyType==1%}trigger alarm{%else%}revover alarm{%endif%},First Trigger time:{{StartTime}}, Triggering conditions:{{Condition}}, Current query results:[{%-for x in TriggerParams-%}{{-x-}} {%-endfor-%}],Additional Notification content:{{NotifyMsg}}",​
"Locale": "zh-CN"​
},​
"NeedValidContent": true​
}​
​
Return example​
​
HTTP/1.1 200 OK​
Content-Type:application/json; charset=utf-8​
{"AlarmContentTemplateId":"28e1c****"}​
​
Error codes​
You can visit Public Error Codes to obtain more information about error codes.​
Last updated: 2025.10.28 18:42:04