Skip to content

Latest commit

 

History

History
455 lines (289 loc) · 11.8 KB

File metadata and controls

455 lines (289 loc) · 11.8 KB

SendbirdPlatformSdk.BotApi

All URIs are relative to https://api-APP_ID.sendbird.com

Method HTTP request Description
createBot POST /v3/bots Create a bot
deleteBotById DELETE /v3/bots/{bot_userid} Delete a bot
joinChannels POST /v3/bots/{bot_userid}/channels Join channels
leaveChannels DELETE /v3/bots/{bot_userid}/channels Leave channels - When leaving all channels
leaveChannelsByUrl DELETE /v3/bots/{bot_userid}/channels/{channel_url} Leave channels - When leaving a channel by its channel URL
listBots GET /v3/bots List bots
sendBotsMessage POST /v3/bots/{bot_userid}/send Send a bot's message
updateBotById PUT /v3/bots/{bot_userid} Update a bot
viewBotById GET /v3/bots/{bot_userid} View a bot

createBot

CreateBotResponse createBot(apiToken, opts)

Create a bot

Create a bot Creates a new bot within the application. Creating a bot is similar to creating a normal user, except that a callback URL is specified in order for the bot to receive events. > Note: The bot must join a group channel first to interact with users. In group channels, you can invite a bot through the invite as members action instead. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-create-a-bot

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let opts = {
  'createBotData': new SendbirdPlatformSdk.CreateBotData() // CreateBotData | 
};
apiInstance.createBot(apiToken, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
createBotData CreateBotData [optional]

Return type

CreateBotResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteBotById

Object deleteBotById(apiToken, botUserid)

Delete a bot

Delete a bot Deletes a bot from an application. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-delete-a-bot ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
apiInstance.deleteBotById(apiToken, botUserid).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String

Return type

Object

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

joinChannels

JoinChannelsResponse joinChannels(apiToken, botUserid, opts)

Join channels

Join channels Makes a bot join one or more channels. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-join-channels ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
let opts = {
  'joinChannelsData': new SendbirdPlatformSdk.JoinChannelsData() // JoinChannelsData | 
};
apiInstance.joinChannels(apiToken, botUserid, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String
joinChannelsData JoinChannelsData [optional]

Return type

JoinChannelsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

leaveChannels

leaveChannels(apiToken, botUserid, opts)

Leave channels - When leaving all channels

Leave channels Makes a bot leave one or more group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-leave-channels ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
let opts = {
  'channelUrl': "channelUrl_example" // String | 
};
apiInstance.leaveChannels(apiToken, botUserid, opts).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String
channelUrl String [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

leaveChannelsByUrl

Object leaveChannelsByUrl(apiToken, botUserid, channelUrl)

Leave channels - When leaving a channel by its channel URL

Leave channels Makes a bot leave one or more group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-leave-channels ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
let channelUrl = "channelUrl_example"; // String | 
apiInstance.leaveChannelsByUrl(apiToken, botUserid, channelUrl).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String
channelUrl String

Return type

Object

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listBots

ListBotsResponse listBots(apiToken, opts)

List bots

List bots Retrieves a list of all bots within an application. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-list-bots ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let opts = {
  'token': "token_example", // String | 
  'limit': 56 // Number | 
};
apiInstance.listBots(apiToken, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
token String [optional]
limit Number [optional]

Return type

ListBotsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

sendBotsMessage

SendBirdMessageResponse sendBotsMessage(apiToken, botUserid, opts)

Send a bot's message

Send a bot's message Sends a bot's message to a channel. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-send-a-bot-s-message ---------------------------- `bot_userid` Type: string Description: Specifies the ID of the bot to send a message.

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
let opts = {
  'sendBotSMessageData': new SendbirdPlatformSdk.SendBotSMessageData() // SendBotSMessageData | 
};
apiInstance.sendBotsMessage(apiToken, botUserid, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String
sendBotSMessageData SendBotSMessageData [optional]

Return type

SendBirdMessageResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateBotById

UpdateBotByIdResponse updateBotById(apiToken, botUserid, opts)

Update a bot

Update a bot Updates information on a bot. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-update-a-bot ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
let opts = {
  'updateBotByIdData': new SendbirdPlatformSdk.UpdateBotByIdData() // UpdateBotByIdData | 
};
apiInstance.updateBotById(apiToken, botUserid, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String
updateBotByIdData UpdateBotByIdData [optional]

Return type

UpdateBotByIdResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

viewBotById

ViewBotByIdResponse viewBotById(apiToken, botUserid)

View a bot

View a bot Retrieves information on a bot. https://sendbird.com/docs/chat/v3/platform-api/guides/bot-interface#2-view-a-bot ----------------------------

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

let apiInstance = new SendbirdPlatformSdk.BotApi();
let apiToken = {{API_TOKEN}}; // String | 
let botUserid = "botUserid_example"; // String | 
apiInstance.viewBotById(apiToken, botUserid).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
apiToken String
botUserid String

Return type

ViewBotByIdResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json