DingTalk Ops Bot Summary Strategy: A Practical Tutorial from Integration Platform to Group Notification
What This Strategy Solves
In multi-strategy supply-chain integration projects, the most painful thing for ops engineers is not "a sync failed," but "no one knew it failed right away." In one engagement with a retail client, more than ten strategies — sales outbound, miscellaneous inbound, real-time inventory — were running in parallel between the ERP and the WMS side. One strategy failed silently overnight and was not noticed until the next morning, by which time thousands of orders had piled up.
This strategy exists to end the "firefighting after the fact" mode: it periodically pulls runtime statistics for a set of key strategies from the Qeasy Data Integration Platform, summarizes them on a schedule, and pushes the result to a DingTalk group bot, so anomalies are seen the moment they happen — not when business calls.
Data Flow and Field Mapping
The end-to-end pipeline splits into three stages: Source (Qeasy statistical API) → Middle layer (variable assembly) → Target (DingTalk group bot WebAPI).
| Stage | Field | Meaning | Handling notes |
|---|---|---|---|
| Source | begin | Statistics start time | Use {{LAST_SYNC_TIME}}; the platform auto-injects the last successful time |
| Source | ids | Strategy ID list | Comma-separated; maintained centrally in the strategy config |
| Middle | name / begin / end / lessee_name | Pass-through to target | Use _function FROM_UNIXTIME(...) to convert timestamps to HH:mm:ss |
| Target | access_token | DingTalk bot credential | Reference from platform vault; never hard-code in the script |
| Target | c_data | Push payload | Assembled by script into a DingTalk message card or text |
Centralized code mapping is one of the common patterns among Qeasy customers: all strategy IDs are kept in the source ids field, so adding or retiring a strategy changes one place only.
How to Configure It in Qeasy
For the source, pick StatisticalStrategyDataV2, type WebAPI, effect QUERY, method POST. Key points:
- Use
{{random}}forid, withidCheck: trueto prevent duplicates; - Set
autoFillResponse: trueso response fields flow back automatically — no need to build the model manually; - Set
buildModel: falsebecause the response schema is stable.
For the target, pick dingTalkGroupMessagesRobot, again WebAPI / POST / EXECUTE.
- Reference
access_tokenfrom Qeasy's credential vault instead of writing it into the request body; - Convert timestamps uniformly via
_function— the source gives Unix timestamps, but humans in a DingTalk group needHH:mm:ss; - Render
c_dataas a Markdown card with separate rows for failure count, timeout count, and backlog size so ops can scan it at a glance.
Implementation Steps
Step 1 — Set the incremental starting point. On first deployment, {{LAST_SYNC_TIME}} has no historical value. Manually backfill a starting point in Qeasy (e.g., 24 hours ago) to avoid pulling a huge initial window and overflowing the message card.
Step 2 — Decide on the bulk trigger. An ops bot does not need bulk initialization; it is itself a "watch the delta" tool. True bulk only happens on the first configuration; afterwards it is purely schedule-driven.
Step 3 — Pick the schedule cadence. In the source material the source cron is 3 9-22/3 * * *, meaning every 3 hours at minute 3, from 09:00 to 22:00. The target cron is offset to 20 9-22/3 * * *, leaving a 17-minute window for the source to aggregate. Recommended practice: "high frequency during the day, low frequency at night" — turn it off between 22:00 and 09:00 to avoid noise.
Step 4 — Validate on small traffic. Start with only 1–2 strategy IDs in ids. Verify message format, mentions, and link jumps before gradually adding the rest.
Step 5 — Go live and watch. During the first week, check every day whether pushes are missed or fields are empty. After that, downgrade to a weekly review.
Pitfalls and Lessons
- Forgetting to backfill
{{LAST_SYNC_TIME}}causes a null pointer on first run. On a brand-new configuration the platform has no "last successful time," and the source API may error out directly. The safe approach is to run once manually and write the timestamp back into metadata. - Hard-coding
access_tokeninside the JSON request. This was actually seen in one on-site session — when the bot secret rotated, the change was almost missed. Qeasy's credential vault exists exactly for this case; reference it, do not embed it. idsbecomes an unmaintainable copy-paste string. Stacking 14 strategy IDs on one line scares everyone away from editing. A common Qeasy pattern is to extract this into a constant configuration block so one edit applies to all.- Pushing raw timestamps into the message. A raw
1719832345in a DingTalk group is unreadable. The middle layer must use_function FROM_UNIXTIMEto produce human-readable text. - Running daytime cadence at night too. After being woken up a few times by bot messages at 3 a.m., the team finally realized that "high frequency by day, low frequency by night" is the humane default.
When It Fits, When It Does Not
Fits: Multi-strategy, ops-monitored supply-chain integration projects where the team already uses DingTalk as the collaboration tool. Especially useful when strategy count ≥ 5 and they span multiple business modules.
Does not fit: Tiny projects with only one or two strategies (platform logs are enough). Also not suitable for intranet environments that disallow third-party IM tools — in that case use email or SMS gateways; the approach is the same.