Create

POST api/v1/channel/create

  • Note: This is to creat a group chat. There are two group types: regular and peer-to-peer. With a regular group chat, there can exist an admin and multiple members. With a peer-to-peer group chat, there exists only two members, and you cannot add or remove members.

  • Header

Field
Type
Remarks

ApiKey

String

Authorization

String

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

  • Request Parameters

Field
Type
Remarks

name

String

name of the group chat

type

String

Group Chat Type, enumerated as: G-Regular Group Chat, P-p2p Group Chat

members

Array[String]

The collection of group members' relationId. If type=P, then it will only see the caller and the first user as group chat members. The admin of the group chat is the current caller.

  • Request Example

curl POST 'https://api.relationlabs.ai/api/v1/channel/create' \
--header 'ApiKey: <ApiKey>' \
--header 'Authorization: bearer eyJhbGciOiJFUzI1Ni19.eyJqdGkiOiI0MzdiN2EzZDEwMGY0ODVkOWVhMWUzZmZlOWE1NmEyZSIsImlz1cyI6InJlbGF0aW9ubGFicy5haSIsImlhdCI6MTY2NTIxNTUzNSwic3ViIjoiZGhreXEtc3FhYWEtYWFhYWotc2d6M3EtY2FpIiwiZXhwIjoxNjY1ODIwMzM1fQ.rj7KKuIcgmvaIwZ63YHnXQ4jvvI-eR2Wo7k3YEyzMuxo8j5ezCowKDpcW0u9zI1uHPFqwD0-1XPWdPLR1d1HLFw' \
--header 'Content-Type: application/json' \
--data-raw '{
  "members": [
    "dhkyq-sqaaa-aaaaj-sgz3q-cai","qddyo-3aaaa-aaaaj-allxa-cai"
  ],
  "name": "test-group",
  "type": "G"
}'
  • Response Parameters

Field
Type
Remarks

code

String

the Return Code

desc

String

the Return Message

data

CreateChannelResponse

the data

The CreateChannelResponse field consists of the following subfields:

Field
Type
Remarks

channelUuid

String

the uuid of the group chat

  • Response Body

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

code
desc
Remarks

0

success

the flag for a successful request

13101

group type error

Cannot recognize the group type

Last updated