Actions38
- User Actions
- Department Actions
- User Group Actions
- User Group Member Actions
- Unit Actions
- Workforce Type Actions
- Custom User Field Actions
- Contact Scope Actions
Overview
The "Create A Department" operation in the "Department" resource of the Lark Contacts node allows users to create a new department within their organization's contact structure on the Lark platform. This operation is useful for automating organizational management tasks such as setting up new teams, defining hierarchical relationships between departments, and assigning leaders or units to departments.
Typical use cases include:
- Automatically creating departments when onboarding new divisions or projects.
- Structuring company contacts programmatically to reflect organizational changes.
- Integrating with HR systems to keep department data synchronized.
For example, a company could use this node to create a new marketing department, assign a team leader by user ID, specify its parent department, and optionally create a group chat for the department members.
Properties
Name | Meaning |
---|---|
Authentication | Method of authentication to use: "Tenant Token" or "OAuth2". |
Create Group Chat | Boolean flag indicating whether to create a group chat for the new department (true/false). |
Department Id | Unique identifier string for the department being created. |
I 18 N Name | Localized names for the department in multiple languages; supports English (en_us), Japanese (ja_jp), and Chinese (zh_cn). |
Leader User Id | User ID of the department leader. |
Name | Name of the department. |
Order | String representing the order or priority of the department (used for sorting). |
Parent Department Id | Identifier of the parent department under which this new department will be nested. |
Unit Ids | List of unit IDs associated with the department. |
Custom Body | JSON object allowing users to provide a fully custom request body instead of using individual properties. |
Options > Use Custom Body | Boolean option to toggle between using the predefined properties or sending a custom JSON body. |
Output
The node outputs JSON data representing the response from the Lark API after attempting to create the department. This typically includes details about the newly created department such as its ID, name, hierarchy, and any metadata returned by the API.
If the "Create Group Chat" option is enabled, the output may also include information about the created group chat associated with the department.
No binary data output is involved in this operation.
Dependencies
- Requires an active connection to the Lark platform via either:
- An API key credential (referred to as "Tenant Token").
- OAuth2 authentication.
- The node sends requests to the Lark Open APIs endpoint at
https://open.larksuite.com/open-apis
. - Proper permissions/scopes must be granted to the credentials used to allow department creation and group chat creation.
Troubleshooting
- Authentication Errors: If the node fails due to authentication issues, verify that the provided token or OAuth2 credentials are valid and have not expired.
- Invalid Department Data: Errors may occur if required fields like
name
ordepartment_id
are missing or malformed. Ensure all mandatory fields are correctly filled. - Permission Denied: The authenticated user or token might lack sufficient permissions to create departments or group chats. Check API scopes and roles.
- API Rate Limits: Frequent calls may hit rate limits imposed by Lark's API. Implement retries with backoff or reduce call frequency.
- Custom Body Misconfiguration: When using the custom JSON body option, ensure the JSON structure matches the expected API schema exactly to avoid request failures.