Skip to main contentIBM Video Streaming Developers

Chat Initialization

Initialization

GET https://api.video.ibm.com/channels/{channelId}/chat.json

Success response

Upon success, a response with HTTP status “200 OK” is returned with the following key-value pairs inside the chat root object.

KEYTYPEDESCRIPTION
stream_dataobjectData for connect
stream_data.api_base_urlstringService base url
stream_data.api_keystringApi key for the service
stream_data.channel_idstringChannel id for the connection
stream_data.channel_typestringChannel type
stream_data.teamstringTeam identifier
userobjectUser related data
user.default_namestring¦nullDefault name based on the token
user.idstringUser identifier
user.has_verified_userbooleanIs the user known based on the access token or generated randomly
user.tokenstringToken for the service

Example of a success response:

{
"chat": {
"stream_data": {
"api_base_url": "https://chat-proxy-us-east.stream-io-api.com",
"api_key": "abc123",
"channel_id": "channel_12345678",
"channel_type": "chatroom",
"team": "team_12345678"
},

Error responses

Possible error responses:

HTTP RESPONSE CODEERROR VALUEERROR CONDITIONS
400 Bad Requestbad_requestInvalid value was supplied
401 Unauthorizedinvalid_tokenThe provided access token is missing, revoked, expired or malformed
402 Payment Requiredinvalid_requestThe user does not have the streamchat benefit
404 Not Foundnot_foundChannel not found
503 Service UnavailableThere is a temporary error on the server which makes it impossible to serve the request

Initialize a group chat

POST https://api.video.ibm.com/channels/{channelId}/chat/groups.json

Parameters

KEYTYPEIMPORTANCEDESCRIPTION
participant_idsstring[]REQUIREDIds of other participants in the group/direct chat
chat_tokenstringREQUIREDChat token returned at initialization
namestringOPTIONALName of the group chat

The Content-Type of the request should be application/x-www-form-urlencoded.

Example of the request:

POST /channels/1234/chat/groups.json HTTP/1.1
Host: api.video.ibm.com
Authorization: Bearer 3c2573673b782f6544405a22636f3d5d3b6f3950
Content-Type: application/x-www-form-urlencoded
participant_ids[]=abcdef12345&participant_ids[]=abcdef12346&chat_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJOb3RoaW5nIHRvIHNlZSBoZXJlIn0.JBqm9SULSLYo2f8-MD7JCQZX-Iyc7dUJ-Tm6kIvDxjA&name=Our%20chat

Success response

Upon success, a response with HTTP status “200 OK” is returned with the following key-value pairs inside the group root object.

KEYTYPEDESCRIPTION
channel_idstringId of the new group chat
channel_typestringType of the new group chat
teamstringTeam the group chat belongs to

Example of a success response:

{
"group": {
"channel_id": "private_1234",
"channel_type": "groupchat",
"team": "team_12345678"
}
}

Error responses

Possible error responses:

HTTP RESPONSE CODEERROR VALUEERROR CONDITIONS
400 Bad Requestbad_requestInvalid value was supplied
401 Unauthorizedinvalid_tokenThe provided access token is missing, revoked, expired or malformed
402 Payment Requiredinvalid_requestThe user does not have the streamchat benefit
403 Forbiddenlack_of_ownershipThe API user is not allowed to manage the given channel
404 Not Foundnot_foundChannel not found
503 Service UnavailableThere is a temporary error on the server which makes it impossible to serve the request