Background
Replying to a message with a bot is essentially the same process as sending a message with a bot. Therefore, in this document, replying and sending have the same meaning. Messages can be sent through either the Server API or a Webhook. The following sections introduce both methods.Prerequisites
- Complete the Create an app process.
- Complete the process of adding app capabilities.
Send messages through a Webhook
Send messages through a Webhook
Sending messages through a webhook supports the @ feature. See the integration example below for details.
-
Send messages through the app bot Webhook URL:
- In Bot receives messages, obtain the Webhook URL of the app bot in the group. For details, see Obtain the app bot Webhook.
-
Java development environment setup:
-
Import the Java SDK. For SDKs in other languages, see the legacy Server-side SDK download.
-
Import the Java SDK. For SDKs in other languages, see the legacy Server-side SDK download.
-
Integration code example:
For more message types, see the message types supported by Custom bot message sending.
-
Send messages through the sessionWebhook field returned when the bot receives a message.
- Obtain the sessionWebhook URL from the JSON data returned in Bot receives messages.
-
Java development environment setup:
-
Import the Java SDK. For SDKs in other languages, see the legacy Server-side SDK download.
-
Import the Java SDK. For SDKs in other languages, see the legacy Server-side SDK download.
-
Integration code example:
For more message types, see the message types supported by Custom bot message sending.
Send messages through the Server API
The following table lists the Server APIs for sending messages. For more API details, see Bot Server API.| API name | Description |
|---|---|
| Bot sends group chat messages | Send messages in a group. The @ feature is not supported yet. |
| Send bot messages in one-on-one chats in batches | Send messages in person-to-bot chats. The @ feature is not supported yet. |
| Bot sends plain messages in person-to-person chats | Send messages in person-to-person chats. The @ feature is not supported yet. Note Use only in Direct Message Cool App scenarios. |