Send a message to the specified communication customization order, used for communication between users and administrators.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- Access requires user login
- Can only send messages to orders belonging to the current user
- Supports various message types: text, images, quotes, videos, files, etc.
Request address
{域名地址}/api/communication/message/send
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/communication/message/send
Request Syntax
POST {域名地址}/api/communication/message/send
Content-Type: application/json
Request Headers
This interface also involves common request headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Request parameters
| Field name | Type | Required | Description |
|---|---|---|---|
| comm_order_id | int | Is | Communication order ID |
| sender_id | int | Is | sender ID |
| Sender name | string | No | Sender's name |
| Message type | string | Is | Message type: text, image, quote, video, file, audio, location, contact, sticker, unknown |
| content | string | Is | Message Content |
Response header
This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Return parameters
| Field name | Type | Description |
|---|---|---|
| code | int | Error code |
| msg | string | Error description |
Usage Example
Example Request (Send Text Message)
POST /api/communication/message/send HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"comm_order_id": 123,
"sender_id": 1000,
"sender_name": "testuser",
"message_type": "text",
"content": "您好,我想了解这个定制方案的详细信息"
}
Example Request (Send Image Message)
POST /api/communication/message/send HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"comm_order_id": 123,
"sender_id": 1000,
"sender_name": "testuser",
"message_type": "image",
"content": "https://en.anqicms.com/uploads/image.jpg"
}
Response Example
{
"code": 0,
"msg": "消息发送成功"
}
error code
| Error code | Description |
|---|---|
| 0 | OK |
| -1 | Error, the reason is indicated in msg |
| 1001 | Not logged in |
| 1002 | Not authorized |
| 200 | API request OK |