Skip to content

Notification Groups

Notification Groups are reusable channel configurations — WeCom, DingTalk, Email, and others — that alarm and notification actions in RPC and trigger scripts can dispatch to by name. Configure a group once and reference it from any script across the organization.

Configuration

Go to System Management → Notification Groups to create and manage groups.

FieldDescription
NameUnique identifier used in scripts, e.g. WeCom_ops, alarm_email. Scripts reference this name in the notice_groups array. Case-sensitive.
ChannelNotification channel: WeCom, DingTalk, Email, Slack, Telegram, etc.
Channel SettingsChannel-specific parameters such as webhook URL, recipient addresses, or SMTP configuration.

After saving, the group name is immediately available in any RPC or trigger script in the organization.

How Scripts Reference Notification Groups

type: "alarm" — Create an alarm AND notify

Use this when you need a record in the ThinkLink alarm center AND want to push a notification.

javascript
return [{
    type: "alarm",
    params: {
        id: "over_temp_01",          // unique alarm identifier
        level: "high",               // low | mid | high | urgent
        title: "Temperature too high",
        desc: `Current: ${device.telemetry_data.temperature}°C`,
        notice_groups: ["WeCom_ops", "alarm_email"]
    }
}];

Pair every alarm with a matching clear action so the alarm closes when the condition resolves:

javascript
return [{
    type: "alarm",
    params: { id: "over_temp_01", type: "clear" }
}];

type: "notify" — Send a message only (no alarm record)

Use this for reminders, daily reports, or third-party callback receipts where no alarm record is needed.

javascript
return [{
    type: "notify",
    params: {
        title: "Daily report",
        desc: "All devices online.",
        notice_groups: ["WeCom_ops"]
    }
}];

Comparison

Aspectalarmnotify
Creates alarm record
Dispatches to notice_groups
Requires paired clear action
De-duplication (same id)

💡 Need both "keep a record" and "push a message"? Use type: "alarm". Need "push only, no record"? Use type: "notify". Both share the same notice-group dispatch path.

Storing Notice Groups on the Device

A common pattern for device-specific notification routing: store the list of group names in the device's server attributes under the key notify. Scripts then read it at runtime rather than hard-coding group names.

Set on the device detail page (Server Attributes):

Key: notify
Value: ["WeCom_ops", "alarm_email"]

Read in an RPC or trigger script:

javascript
// Direct read
let notify = params?.notify ?? [];   // params.notify = device.server_attrs.notify (flat array)

// TriggerHelper does this automatically:
// this.group = device.server_attrs.notify
// Just pass it to notice_groups:
return [{
    type: "alarm",
    params: {
        id: "over_temp",
        notice_groups: notify,
        ...
    }
}];

TriggerHelper (from tklHelper) reads device.server_attrs.notify automatically and stores it as this.group. You do not need to extract it manually when extending TriggerHelper.

Message Format by Channel

The format of the desc field depends on the channel type of the receiving group:

ChannelRenderingRecommended desc format
WeComMarkdownUse **bold**, \n line breaks, emoji
DingTalkMarkdownSame as WeCom
EmailHTML / plain textHTML supported; keep the body concise
Slack / TelegramPlain textMarkdown may vary by client

If a single action lists groups of different channel types, the same desc is rendered by each channel's own rules. For clean output on every channel, split into one type: "notify" per channel, each with a channel-appropriate desc.

Example: split notify by channel

javascript
return [
    {   // WeCom — Markdown format
        type: "notify",
        params: {
            title: "Alarm cleared",
            desc: "**Device:** " + device.name + "\n**Status:** recovered",
            notice_groups: ["WeCom_ops"]
        }
    },
    {   // Email — plain text
        type: "notify",
        params: {
            title: "Alarm cleared",
            desc: "Device: " + device.name + " has recovered.",
            notice_groups: ["alarm_email"]
        }
    }
];