Lark
CodeArts Agent Space provides IM access capabilities for multiple platforms, supporting the reuse of agent capabilities across these platforms alongside unified configuration management.
This section describes how to connect CodeArts Agent Space to Lark, allowing you to quickly integrate capabilities and enable collaborative workflows.
Constraints
| Category | Description |
|---|---|
| Function | A Lark bot can connect to only one CodeArts Agent Space. |
Procedure
Step 1: Preparations
- Create a custom application.
Log in to the Lark open platform, click Developer Console in the upper right corner, and click Create Custom App on the Custom Apps tab.
- Add a bot.
Go to the Add Features page. On the By Feature tab, click Add under a bot to add the bot for the application.
- Add application permissions for the bot.
Go to the Permissions & Scopes page and click Add permission scopes to app. On the Tenant token scopes tab, add the following permissions for the bot:
- Obtain group information (im:chat:readonly)
- Obtain and send direct messages and group chat messages (im:message)
- Obtain and update group information (im:chat)
- Receive users' mentions (im:message.group_at_msg:readonly)
- Receive other bots' and users' mentions (im:message.group_at_msg.include_bot:readonly)
- Get direct messages sent to bot (im:message.p2p_msg:readonly)
- Send messages as an app (im:message:send_as_bot)
- Read and upload images or other files (im:resource)
- Get card information (cardkit:card:read)
- Create and update card (cardkit:card:write)
- Add events and callbacks for the bot.
- Go to the Events & Callbacks page. In the Event configuration area, select Receive events through persistent connection under Subscription mode and click Save.
Subscription mode must be set to Receive events through persistent connection.
- Click Add Events. On the Tenant Token-Based Subscription tab, add the following events:
- Bot added to group (im.chat.member.bot.added_v1)
- Bot removed from group (im.chat.member.bot.deleted_v1)
- Message_received (im.message.receive_v1)
- Message-read (im.message.message_read_v1)
- Go to the Events & Callbacks page. In the Callback configuration area, select Receive callbacks through persistent connection under Subscription mode and click Save.
Subscription mode must be set to Receive callbacks through persistent connection.
- Click Add callback, search for and add Card callback communication (card.action.trigger).
- Go to the Events & Callbacks page. In the Event configuration area, select Receive events through persistent connection under Subscription mode and click Save.
- Release the application.
Go to the Credentials & Basic Info page, click Create Version in the upper part of the page, and submit the application release request. Then, choose Version Management & Release under App Versions to check the progress. If the version status is Released, the application has been successfully released.
- Obtain the application credential.
Go to the Credential & Basic Info page. In the Credentials area, obtain App ID and App Secret. This credential will be used when you connect to the Lark bot in CodeArts Agent Space.
Step 2: CodeArts Agent Space Configuration
- Access CodeArts Agent Space by referring to Enabling CodeArts Agent Space.
- In CodeArts Agent Space, click Select Project Folder, choose Open Project, and open a folder. Figure 1 Opening a folder
- Click
in the upper right corner of CodeArts Agent Space to open the settings page. - Choose IM Integration and click Configure next to Lark. The Register Lark Channel page is displayed.
- Enter the Lark application credentials (Client ID/Client Secret) obtained in 6 and click Register. Figure 2 Registering Lark
Wait until the registration is complete. When the status changes from Connecting to Connected, the Lark bot is successfully registered.
Step 3: Remote Control from Lark
- Log in to the Lark client and add the bot.
- One-to-one chat: In the search box of the Lark client, search for the bot created in 2. Click the search result to access it.
- Group chat: In the upper right corner of the Lark client, click ... and choose Settings. In the Bots area, click Add Bot. Search for the bot created in 2, click the search result, and click Add to add the bot to the group chat.
- Describe the task to the Lark bot and click Send to submit the task.
The bot automatically receives feedback from CodeArts Agent Space. You can use slash commands on the Lark client to trigger corresponding functions more effectively.
- Confirm the task requirements and key information based on the feedback and complete the task creation.
- Check the task execution result.
- Lark bot: The Lark bot receives a completion message from CodeArts Agent Space, indicating that the task execution is complete and providing the location of the deliverables.
- CodeArts Agent Space: IN IM > Lark, you can check the task execution process and result in real time. Click
in the upper right corner of the chat window to view the generated deliverables in the task artifact list.
Slash Commands Supported by the Lark Client
| Command | Description |
|---|---|
| /stop | Stops the current session. |
| /help | Checks available commands. |
| /new | Initiates a new chat. When a new chat is created, CodeArts Agent Space automatically saves the original chat to the history list. After this, you will enter a new chat environment and cannot return to the previous chat. |
| /models | Checks and switches models. (Only CodeArts Agent Space built-in models) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot