messageSend
mutation
需要 unauthenticated_write_message 权限点。
接口访问需要令牌,具体如何获取令牌参考:身份认证。
在聊天应用或消息系统中发送新消息。调用本接口前需确保已通过 conversationCreate 接口创建会话。
Example
发送消息
Code
mutation {
messageSend(
input: {
storeId: "******2170"
conversationId: "gid://shopline/Conversation/******403588"
content: "demoString"
contentAttachmentUrl: "demoString"
messageType: TEXT
}
) {
userErrors {
code
field
message
}
message {
contentAttachmentUrl
messageType
createAt
conversationId
sendErrorCode
senderType
sendStatus
id
storeId
userId
content
}
}
}
Response
{
"messageSend": {
"message": {
"createTime": null,
"id": null,
"storeId": "******2170",
"content": "demoString",
"conversationId": "gid://shopline/Conversation/******403588",
"messageType": "TEXT",
"sendErrorCode": "",
"sendStatus": "SEND_SUCCESS",
"senderType": "USER",
"userId": "gid://shopline/ThirdUser/******5235111",
"contentAttachmentUrl": ""
},
"userErrors": []
}
}
这篇文章对你有帮助吗?