Callback After Sending Group Chat Message
Functional Description
The App business server can operate on users' group chat messages in real-time through this callback, such as:
- Recording group chat messages in real-time (logging or synchronizing to other systems).
- Performing data statistics on group chat messages (counting people, messages, etc.).
Precautions
- To enable the callback, you must configure the callback URL and turn on the switch corresponding to this callback protocol. See the Callback Description document for configuration methods.
- The callback direction is an HTTP/HTTPS POST request initiated by OpenIMServer to the App backend.
- The APP business server must respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- App users send group chat messages through the client.
- App administrators send group chat messages through REST API
Timing of Callback
- After OpenIMServer receives the group chat message sent by the user and delivers the message to the target user.
Interface Description
Request URL Example
Here CallbackCommand is: callbackAfterSendGroupMsgCommand
{WEBHOOK_ADDRESS}/callbackAfterSendGroupMsgCommand?contenttype=json
Request Package Example
{
"sendID": "user123",
"callbackCommand": "callbackAfterSendGroupMsgCommand",
"serverMsgID": "serverMsg123",
"clientMsgID": "clientMsg123",
"operationID": "1646445464564",
"senderPlatformID": 1,
"senderNickname": "John Doe",
"sessionType": 1,
"msgFrom": 1,
"contentType": 1,
"status": 1,
"sendTime": 1673048592000,
"createTime": 1673048592000,
"content": "Hello, how are you?",
"seq": 1,
"atUserList": ["user456", "user789"],
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data",
"recvID": "user456"
}
Request Package Field Description
| Object | Type | Description |
|---|---|---|
| sendID | string | User ID of the sender |
| callbackCommand | string | Callback command, here it is the callback after sending a group chat message |
| serverMsgID | string | Message ID generated by the server |
| clientMsgID | string | Message ID generated by the client |
| operationID | string | operationID used for global link tracking |
| senderPlatformID | int32 | Platform ID of the sender |
| senderNickname | string | Nickname of the sender |
| sessionType | int32 | Session type, 1: single chat, 2: group chat, 4: system notification |
| msgFrom | int32 | Message source, 100 originates from user sending, 200 originates from administrator sending or system broadcast notification, etc. |
| contentType | int32 | Message content type, 101 represents text message, 102 represents picture message, 103 represents voice message, ... |
| status | int32 | Message status, 1 means sending successful, 2 means sending failed |
| sendTime | int64 | Timestamp of message sending (milliseconds) |
| createTime | int64 | Timestamp of message creation (milliseconds) |
| content | string | Message content |
| seq | uint32 | Message sequence number |
| atUserList | string | List of group chat member IDs, ignored for single chat |
| faceURL | string | Avatar URL of the sender |
| ex | string | Extra data field |
| recvID | string | User ID of the receiver |
Response Package Example
Successful Response
After the App business server synchronizes data, it sends a callback response package
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0
}
Response Package Field Description
| Field | Value | Description |
|---|---|---|
| actionCode | 0 | Indicates whether the business system callback was executed correctly. 0 means the operation was successful. |
| errCode | 0 | Custom error code, 0 here means ignore the callback result. |
| errMsg | "An error message" | Simple error message corresponding to the custom error code. |
| errDlt | "Detailed error information" | Detailed error information corresponding to the custom error code. |
| nextCode | 1 | Next execution instruction, 1 means refusing to continue execution, set when actionCode is 0. |