Send

POST api/v1/message/send

  • Note: To send a message.

  • Header

FieldTypeRemarks

ApiKey

String

ApiKey acquired from the admin

Authorization

String

Bearer ${unifiedAuthToken} , in which the unifiedAuthToken is returned by /api/v1/auth

  • Request Parameters

FieldTypeRemarks

channelUuid

String

Optional. It is the UUID of the group chat. It and channelUuid should at least have one non-null value.

toRelationId

String

Optional. It is the receiver's relationId. It and channelUuid should at least have one non-null value.

type

String

the type of the message. There are 3 default types: text;sys;card. Users can expand them on their own.

content

String

the content of the message

sendUuid

String

The uuid of the message. It is generated and managed by the client.

  • 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": "6u4dp-6qaaa-aaaaj-aag4q-cai-87b4c789ee444d28960dfdd9b208d1ef-1665371575954-35534417409750164"
}'
  • Response Parameters

FieldTypeRemarks

code

String

the Return Code

desc

String

the Return Message

data

SendMessageResponse

the data

The SendMessageResponse field consists of the following subfields:

FieldTypeRemarks

id

String

The unique id of the message

channelUuid

String

the uuid of the group chat

  • Response Body

{
    "code": "0",
    "desc": "success",
    "data": {
        "channelUuid": "4f326124812c41448bc587bf6b2eaf42",
        "id": "1579309168845799425"
    }
}
  • Return Code

codedescRemarks

0

success

the flag for a successful request

10112

parameter error

channelUuid and toRelationId cannot be null at the same time.

13301

block stranger messages

The receiver forbids chatting with with strangers.

13108

Not the member of this channel

Not a group chat member. You cannot send a message.

Last updated