Define the requirements
Before development, review the following overview. This document explains how to use a group template bot to send group chat messages through the group assistant message API. To get started quickly, run the sample demo provided in the Quickstart section. This gives you a hands-on experience with the group template bot.Prerequisites
- Complete the process of creating a group template bot.
-
Complete the API permission application for the OpenAPI. Apply for the
DingTalk group message management permission. -
Prepare the development environment:
- Java: JDK 1.8 or later installed
- Java: Maven 3 installed
Quickstart
- Download the group-template-robot-group-message-quick-start sample demo.
-
Replace the parameters in the main method of groupTemplateRobotGroupMessage:
Configuration item Description GROUP_TEMPLATE_ID Sign in to the Developer Backend, click Open Capabilities > Scenario Group > Group Template, and copy the ID. ROBOT_CODE Sign in to the Developer Backend, click Open Capabilities > Scenario Group > Group Template > Target group template. Copy the bot ID. If the group template is not associated with a bot, refer to associating a group template bot with a group template. OWNER_USER_ID The userId of the user. For details, see User UserId. CLIENT_ID The Client ID of the app. For details, see Client ID. CLIENT_SECRET The Client Secret of the app. For details, see Client Secret. - Run the main method. You will receive the message sent by the bot in the group.
Procedure
-
Add the dependencies to the
pom.xmlfile of the project. -
Create the main method and run it.
A group chat is automatically created, and you can see the message sent by the group template bot in the group.
Related documents
- Send group assistant messages