Skip to content

Latest commit

 

History

History
310 lines (198 loc) · 8.82 KB

File metadata and controls

310 lines (198 loc) · 8.82 KB

SendbirdPlatformSdk.BotApi

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

Method HTTP request Description
createABot POST /v3/bots Create a bot
joinChannels POST /v3/bots/{bot_userid}/channels Join channels
leaveAGroupChannel DELETE /v3/bots/{bot_userid}/channels/{channel_url} Leave channels - When leaving a specific channel
leaveGroupChannels DELETE /v3/bots/{bot_userid}/channels Leave channels - When leaving all channels
listBots GET /v3/bots List bots
sendABotMessage POST /v3/bots/{bot_userid}/send Send a bot's message

createABot

CreateABotResponse createABot(opts)

Create a bot

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

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

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

Parameters

Name Type Description Notes
apiToken String [optional]
createABotRequest CreateABotRequest [optional]

Return type

CreateABotResponse

Authorization

No authorization required

HTTP request headers

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

joinChannels

SendbirdGroupChannelDetail joinChannels(botUserid, opts)

Join channels

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

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

Parameters

Name Type Description Notes
botUserid String (Required)
apiToken String [optional]
joinChannelsRequest JoinChannelsRequest [optional]

Return type

SendbirdGroupChannelDetail

Authorization

No authorization required

HTTP request headers

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

leaveAGroupChannel

Object leaveAGroupChannel(channelUrl, botUserid, opts)

Leave channels - When leaving a specific channel

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

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

Parameters

Name Type Description Notes
channelUrl String
botUserid String (Required)
apiToken String [optional]

Return type

Object

Authorization

No authorization required

HTTP request headers

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

leaveGroupChannels

Object leaveGroupChannels(botUserid, opts)

Leave channels - When leaving all channels

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

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

Parameters

Name Type Description Notes
botUserid String (Required)
apiToken String [optional]

Return type

Object

Authorization

No authorization required

HTTP request headers

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

listBots

ListBotsResponse listBots(opts)

List bots

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

Example

import SendbirdPlatformSdk from 'sendbird-platform-sdk';

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

Parameters

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

Return type

ListBotsResponse

Authorization

No authorization required

HTTP request headers

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

sendABotMessage

SendbirdMessageResponse sendABotMessage(botUserid, opts)

Send a bot's message

Send a bot message Sends a bot message to a group channel. https://sendbird.com/docs/chat/platform-api/v3/bot/sending-a-bot-message/send-a-bot-message#1-send-a-bot-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 botUserid = "botUserid_example"; // String | (Required) 
let opts = {
  'apiToken': {{API_TOKEN}}, // String | 
  'sendABotMessageRequest': new SendbirdPlatformSdk.SendABotMessageRequest() // SendABotMessageRequest | 
};
apiInstance.sendABotMessage(botUserid, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
botUserid String (Required)
apiToken String [optional]
sendABotMessageRequest SendABotMessageRequest [optional]

Return type

SendbirdMessageResponse

Authorization

No authorization required

HTTP request headers

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