发消息
POST api/v1/message/send
说明:发送消息。
Header
Authorization
String
Bearer ${unifiedAuthToken} ,其中unifiedAuthToken来自/api/v1/auth接口的返回
Request Parameters
channelUuid
String
选填,与toRelationId 至少有一个不为空。群组uuid
toRelationId
String
选填,与channelUuid 至少有一个不为空。对方的relationId
type
String
消息类型,当前系统默认的三种类型:text;sys;card,用户可自行扩展
content
String
消息内容
sendUuid
String
消息uuid,由客户端生成维护
quoteId
String
引用的消息id
mentionedUser
Array[String]
提及的用户relationId集合
Request Example
curl POST 'https://api.relationlabs.ai/api/v1/message/send' \
--header 'ApiKey: <ApiKey>' \
--header 'Authorization: bearer eyJhbG1ciOiJFUzI1NiJ9.eyJqdGkiOiI0MzdiN2EzZDEwMGY0ODVkOWVhMWUzZmZlOWE1NmEyZSIsImlzcyI6InJlbGF0aW9ubGFicy5haSIsImlhdCI6MTY2NTIxNTUzNSwic3ViIjoiZGhreXEtc3FhYWEtYWFhYWotc2d6M3EtY2FpIiwiZXhwIjoxNjY11ODIwMzM1fQ.rj7KKuIcgmvaIwZ63YHnXQ4jvvI-eR2Wo7k3YEyz1Muxo8j5ezCowKDpcW0u9zIuHPFqwD0-1XPWdPLR1d1HLFw' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "TEXT",
"channelUuid": "4f326124812c41448bc587bf6b2eaf42",
"toRelationId": null,
"content": "hello",
"sendUuid": "1u4dp-6qaaa-aaaaj-aag4q-cai-87b4c789ee444d28960dfdd9b208d1ef-1665371575954-35534417409750164",
"quoteId":1579047130798100481,
"mentionedUser":["1u4dp-6qaaa-aaaaj-aag4q-cai"]
}'
Response Parameters
code
String
返回码
desc
String
返回信息
data
SendMessageResponse
数据
The SendMessageResponse field consists of the following subfields:
id
String
消息的唯一id
channelUuid
String
群组的uuid
Response Body
{
"code": "0",
"desc": "success",
"data": {
"channelUuid": "4f326124812c41448bc587bf6b2eaf42",
"id": "1579309168845799425"
}
}
Return Code
0
success
接口调用成功
10112
parameter error
channelUuid和toRelationId不能同时为空
13301
block stranger messages
对方开启了禁止陌生人聊天模式
13108
Not the member of this group
非群组成员,无权限发送消息
Last updated