Description
Overview
This automation workflow enables automatic notification of new Azure DevOps Pull Request events via DingTalk messaging. Designed as an orchestration pipeline, it integrates Azure DevOps PR creation events with DingTalk group chat alerts, leveraging a MySQL user mapping table to ensure precise user mentions. The process is initiated by an HTTP POST webhook that listens specifically for Pull Request Created events.
Key Benefits
- Streamlines Pull Request notifications by automating message delivery to DingTalk groups.
- Ensures accurate user mentions by mapping Azure DevOps accounts to DingTalk contacts.
- Supports both individual and team mentions based on reviewer roles in the orchestration pipeline.
- Reduces manual communication steps by directly linking Azure DevOps events to chat alerts.
Product Overview
This no-code integration workflow starts with a webhook node that accepts HTTP POST requests from Azure DevOps Service Hooks configured for Pull Request Created events. Upon receiving an event, the workflow queries a MySQL database table named tfs_dingtalk_account_map to retrieve mappings between Azure DevOps user accounts and their corresponding DingTalk usernames and mobile numbers. The core processing involves a code node that analyzes the incoming PR event payload, replacing Azure DevOps user display names with mapped DingTalk usernames. It also identifies reviewers, distinguishing if any represent an entire team, in which case the message flags an @all mention. Otherwise, it aggregates individual DingTalk mobile numbers for targeted notifications. The final message, formatted in Markdown, is sent synchronously via an HTTP Request node to a DingTalk robot webhook URL, posting a notification titled “New PR Notify” to the appropriate DingTalk group chat. Error handling and retries rely on n8n platform defaults, with no additional custom logic implemented. The workflow maintains transient data processing without persisting sensitive information beyond the MySQL user mapping table.
Features and Outcomes
Core Automation
The automation workflow accepts Pull Request event payloads and applies deterministic rules to build notification messages. It uses the code node to map Azure DevOps accounts to DingTalk users, handling both individual and team mentions within the orchestration pipeline.
- Single-pass evaluation of PR creator and reviewer details to generate message content.
- Conditional logic to trigger @all mentions if a reviewer represents a team.
- Dynamic replacement of display names with mapped DingTalk usernames.
Integrations and Intake
The workflow integrates Azure DevOps Pull Request Created events via a webhook and enriches data using a MySQL database. Authentication for MySQL is credential-based, and the webhook expects a JSON payload with PR details.
- Webhook node listens for HTTP POST requests triggered by Azure DevOps Service Hooks.
- MySQL node queries user mapping table
tfs_dingtalk_account_mapfor account translation. - HTTP Request node posts formatted Markdown messages to DingTalk robot webhook endpoints.
Outputs and Consumption
Outputs consist of Markdown-formatted messages sent synchronously to DingTalk group chats. The payload specifies user mentions either as individual mobile numbers or as an @all mention when applicable.
- Message title fixed as “New PR Notify” in DingTalk notifications.
- Payload includes fields
text,isAtAll, andatMobilesfor message formatting. - Delivery is synchronous via HTTP POST to DingTalk robot webhook URLs.
Workflow — End-to-End Execution
Step 1: Trigger
The workflow initiates upon receiving an HTTP POST request at a webhook path configured for Pull Request Created events from Azure DevOps Service Hooks. The webhook expects a JSON payload containing PR metadata including creator and reviewer details.
Step 2: Processing
The incoming payload undergoes basic presence checks to ensure required fields exist. The workflow then queries the MySQL table tfs_dingtalk_account_map to retrieve user mappings without additional filtering or transformation at this stage.
Step 3: Analysis
A JavaScript code node processes the PR data and user mappings. It replaces Azure DevOps display names with DingTalk usernames and evaluates reviewers to determine whether to mention all users or specific individuals. Reviewers containing the substring “团队” trigger an @all mention flag; otherwise, the workflow collects DingTalk mobile numbers for targeted mentions.
Step 4: Delivery
The constructed Markdown message, including mention instructions, is sent synchronously via an HTTP Request node. This node posts the payload to a DingTalk robot webhook URL, producing a notification titled “New PR Notify” in the DingTalk group chat.
Use Cases
Scenario 1
Development teams need real-time alerts when new Pull Requests are created to streamline code review processes. This automation workflow captures PR events and sends precise DingTalk notifications, ensuring reviewers are promptly informed and able to act without manual message distribution.
Scenario 2
Project managers require consistent communication of code changes to stakeholders across different platforms. By mapping Azure DevOps users to DingTalk contacts, this orchestration pipeline delivers targeted notifications, reducing communication gaps and enhancing collaboration efficiency.
Scenario 3
Organizations with large teams want to automate group notifications for Pull Request reviews. When reviewers represent an entire team, this workflow triggers an @all mention in DingTalk, ensuring comprehensive visibility while maintaining individual mentions for specific reviewers.
How to use
To implement this automation workflow, first configure an Azure DevOps Service Hook to send Pull Request Created event payloads via HTTP POST to the webhook node’s defined path. Set up a MySQL table tfs_dingtalk_account_map containing mappings between Azure DevOps accounts and DingTalk usernames and mobile numbers. Ensure the MySQL credentials are configured within the LoadDingTalkAccountMap node. Customize the message content if needed by editing the JavaScript in the BuildDingTalkWebHookData node. Provide the DingTalk robot webhook URL in the HTTP Request node for message delivery. Once deployed, the workflow runs automatically on each PR creation, sending structured DingTalk notifications with targeted user mentions.
Comparison — Manual Process vs. Automation Workflow
| Attribute | Manual/Alternative | This Workflow |
|---|---|---|
| Steps required | Multiple manual steps including monitoring, message drafting, and sending. | Single automated process triggered by PR creation event. |
| Consistency | Subject to human error and delays in notification. | Deterministic mapping and message delivery with consistent formatting. |
| Scalability | Limited by manual capacity and communication channels. | Handles multiple PRs and user mappings without additional effort. |
| Maintenance | Requires ongoing manual oversight and message updates. | Centralized update in MySQL mapping and message template adjustments. |
Technical Specifications
| Environment | n8n automation platform with MySQL and HTTP webhook support |
|---|---|
| Tools / APIs | Azure DevOps Service Hooks, MySQL, DingTalk Robot Webhook API |
| Execution Model | Triggered synchronous HTTP webhook with sequential node execution |
| Input Formats | JSON payload from Azure DevOps Pull Request Created event |
| Output Formats | Markdown message in JSON payload posted to DingTalk robot webhook |
| Data Handling | Transient processing with MySQL user mapping lookup; no persistent storage of event data |
| Known Constraints | Relies on availability of external Azure DevOps and DingTalk APIs |
| Credentials | MySQL credentials for database access; DingTalk webhook URL for message delivery |
Implementation Requirements
- Azure DevOps Service Hooks configured to send Pull Request Created events to the workflow webhook.
- Accessible MySQL database with
tfs_dingtalk_account_maptable populated with user mappings. - Valid DingTalk robot webhook URL configured in the HTTP Request node for message posting.
Configuration & Validation
- Verify the webhook node path matches the Azure DevOps Service Hook configuration for PR Created events.
- Confirm MySQL credentials and table schema are correctly set and contain valid account mappings.
- Test message delivery by sending a sample PR event and checking DingTalk group chat for accurate notifications.
Data Provenance
- Trigger node:
ReceiveTfsPullRequestCreatedMessage(Webhook, HTTP POST trigger) - User mapping node:
LoadDingTalkAccountMap(MySQL query ontfs_dingtalk_account_map) - Message assembly node:
BuildDingTalkWebHookData(JavaScript code processing PR payload and user mappings)
FAQ
How is the Pull Request notification automation workflow triggered?
The workflow is triggered by an HTTP POST webhook that receives Azure DevOps Pull Request Created event payloads.
Which tools or models does the orchestration pipeline use?
It uses a MySQL database for user account mapping and a JavaScript code node to process event data and build DingTalk messages.
What does the response look like for client consumption?
The workflow outputs a Markdown-formatted message with user mentions, sent synchronously to DingTalk group chats via a webhook.
Is any data persisted by the workflow?
Only the user account mapping data is stored in MySQL; event payloads are processed transiently without persistence.
How are errors handled in this integration flow?
Error handling relies on n8n platform defaults; no custom retry or backoff logic is implemented in the workflow.
Conclusion
This automation workflow provides a reliable, deterministic method for notifying DingTalk users about new Azure DevOps Pull Requests by mapping user accounts and constructing targeted messages. It ensures consistent communication with minimal manual intervention through synchronous webhook-triggered execution and MySQL-based user mapping. The workflow depends on external API availability from Azure DevOps and DingTalk, which is a key operational constraint. Overall, it offers a structured, maintainable solution that integrates real-time development events with team collaboration tools.








Reviews
There are no reviews yet.