Skip to main content
Generate a unique Wecom robot address in Flashduty, and synchronize the occurrence and recovery of alerts through Wecom.

Operation steps

Create WeCom Bot Compatible integration

You can obtain a WeCom Bot Compatible integration address through either of these two methods:

Use a dedicated integration

Choose this option if all alerts go to one channel. It’s the simpler setup.
  1. In the Flashduty console, select Channel and open a channel
  2. Select Configuration → Integrations → Private integration, then click Add integration
  3. Choose WeCom Bot Compatible integration and click Save to generate a card
  4. Click the generated card to view the WeCom Bot Compatible Integration URL, copy it for later use, and you’re done

Use a shared integration

Choose this option if you need to route alerts to different channels based on the alert payload.
  1. In the Flashduty console, go to Integration Center → Alert Events
  2. Select WeCom Bot Compatible integration:
    • Integration Name: Define a name for the current integration
    • Message Type: Doesn’t affect receiving; leave the default
    • Push Mode: Choose when to trigger or recover alerts for Wecom notifications
  3. Copy the WeCom Bot Compatible Integration URL for later use
  4. Configure the default route and select the corresponding channel (after integration creation, you can go to Routes to configure more routing rules)

Configure the WeCom Bot Compatible integration

1

Choose the message type and push mode in Flashduty

Where: Flashduty › Integration Center › Alert events › WeCom Bot Compatible › Alert push settingsThe alert title of the WeCom integration is always “企业微信机器人告警”, so only Always trigger new alert and Trigger or close alert based on rules are available, and rules can only extract the Alert Key from Message content.Click Save and copy the Push URL.
2

Replace the WeCom group robot webhook URL with the push URL in the sender

Where: the webhook settings of the WeCom group robot notification in the sending tool (menus vary by tool)
3

Send a test message from the sender and confirm

Where: the test option of that webhook notification in the sending tool (if there’s no test option, wait for a real alert)After a few seconds, the integration in Flashduty shows a Latest event time, which means the setup works. If it doesn’t, check that the message type is supported (see “Notes” below).

Push modes and rules

With Trigger or close alert based on rules:
  • At least one trigger rule is required.
  • Close rules are checked before trigger rules; within each type, rules are checked in the configured order, and the first match wins.
  • Every rule needs an Alert Key regex. The system uses the Alert Key to find the open alert to update or close. The regex must be a valid RE2 expression; it is validated on save, and an invalid expression is rejected with the message “Please enter valid regex”.
  • The Alert Key is built from the regex capture groups, joined with ,. If the regex captures nothing, the system generates a random Alert Key: the message still creates an alert, but it isn’t merged with other messages and can’t be closed by a recovery message.
  • Default rules: if none of the rules above match, create new alert (each message creates a new alert) or discard message.
Example:
  • Rule 1: close, condition “Message content matches /RESOLVED/”
  • Rule 2: trigger, condition “Message content matches /PROBLEM/”
  • Both rules extract the Alert Key from Message content with the regex:
The messages PROBLEM: web-01 disk usage 93% and RESOLVED: web-01 disk usage 71% both capture web-01 disk, so they get the same Alert Key and the recovery message closes the alert. The regex has no ^, because other text may come before it in the message content.

Why /(.*)/ can’t be used as the Alert Key regex

/(.*)/ captures the whole content. Trigger and recovery messages have different content and so get different Alert Keys; the recovery message finds no matching alert, and the alert is never closed. Capture only the part that identifies the problem, such as the host and check in the example above.

No-event detection

No-event detection works for push alert integrations, except HTTP Pull and DB Pull: when an integration receives no valid event for the detection period, it creates a Warning alert. The switch is off by default and the detection period defaults to 10 minutes. See Alert integrations overview.

Notes

  • The WeCom Bot Compatible integration only accepts text, markdown, and markdown_v2 messages; other message types can’t be received.
  • The alert title is always “企业微信机器人告警”. To change the title, use the alert pipeline.

Status and severity

Alerts pushed to Flashduty through the WeCom Bot Compatible integration always have Warning severity. To set the severity from the message content, add rules on the integration’s Alert pipeline tab; see alert pipeline.