Actions25
Overview
This node integrates with a WeChat Work (企业微信) API to manage organizational departments. Specifically, the "更新部门" (Update Department) operation allows users to modify details of an existing department within their WeChat Work organization structure. This is useful for keeping department information up-to-date, such as changing department names, adjusting hierarchy by setting parent departments, or reordering departments.
Practical examples include:
- Renaming a department after a company rebranding.
- Changing the parent department to reflect organizational restructuring.
- Adjusting the display order of departments in the directory.
Properties
| Name | Meaning |
|---|---|
| 部门ID | The unique identifier of the department to update. This is required to specify which department to modify. |
| 部门名称 | The new name of the department. Must be 1 to 64 UTF-8 characters and cannot include :*?"<>|. |
| 英文名称 | The English name of the department. Requires multi-language support enabled in the admin backend. Same character restrictions as 部门名称. |
| 父部门ID | The ID of the parent department under which this department will be placed. |
| 次序值 | The order value within the parent department. Higher values are sorted before lower ones. Valid range: [0, 2^32). |
Output
The node outputs JSON data representing the result of the update operation for each input item. Each output item corresponds to one update request and contains either the successful response from the WeChat Work API or an error message if the update failed.
If errors occur and the node is configured to continue on failure, the output JSON will include an error field describing the issue.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential for authenticating with the WeChat Work API.
- The node uses the WeChat Work API endpoint to perform operations; thus, internet access and valid credentials are necessary.
- The node expects the base URL, corporate ID, and secret for authentication.
- No additional external dependencies beyond the standard n8n environment and the provided credentials.
Troubleshooting
Common issues:
- Invalid or missing department ID (
部门ID) will cause the update to fail. - Providing invalid characters in department names may result in API errors.
- Incorrect parent department IDs can cause hierarchical inconsistencies or API rejection.
- Insufficient permissions or expired credentials will lead to authentication errors.
- Invalid or missing department ID (
Error messages:
- Errors returned from the WeChat Work API will be included in the output JSON under the
errorfield if "continue on fail" is enabled. - If not continuing on failure, the node will throw an error stopping execution, showing the API error message.
- Errors returned from the WeChat Work API will be included in the output JSON under the
Resolution tips:
- Verify that all required fields are correctly filled.
- Ensure department names comply with character restrictions.
- Confirm that the API credentials are valid and have sufficient permissions.
- Check network connectivity to the WeChat Work API endpoint.
Links and References
- WeChat Work Official API Documentation
- n8n Documentation on Creating Custom Nodes
- WeChat Work Department Management API (for detailed API parameters and responses)