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 |
CreateBotResponse createBot().apiToken(apiToken).createBotData(createBotData).execute();
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
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String apiToken = "{{API_TOKEN}}"; // String |
CreateBotData createBotData = new CreateBotData(); // CreateBotData |
try {
CreateBotResponse result = api.createBot()
.apiToken(apiToken)
.createBotData(createBotData)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#createBot");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| apiToken | String | [optional] | |
| createBotData | CreateBotData | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
Object deleteBotById(botUserid).apiToken(apiToken).execute();
Delete a bot
Deletes a bot from an application.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
try {
Object result = api.deleteBotById(botUserid)
.apiToken(apiToken)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#deleteBotById");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| apiToken | String | [optional] |
Object
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
JoinChannelsResponse joinChannels(botUserid).apiToken(apiToken).joinChannelsData(joinChannelsData).execute();
Join channels
Makes a bot join one or more channels.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
JoinChannelsData joinChannelsData = new JoinChannelsData(); // JoinChannelsData |
try {
JoinChannelsResponse result = api.joinChannels(botUserid)
.apiToken(apiToken)
.joinChannelsData(joinChannelsData)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#joinChannels");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| apiToken | String | [optional] | |
| joinChannelsData | JoinChannelsData | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
leaveChannels(botUserid).apiToken(apiToken).channelUrl(channelUrl).execute();
Leave channels - When leaving all channels
Makes a bot leave one or more group channels.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
String channelUrl = "channelUrl_example"; // String |
try {
api.leaveChannels(botUserid)
.apiToken(apiToken)
.channelUrl(channelUrl)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#leaveChannels");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| apiToken | String | [optional] | |
| channelUrl | String | [optional] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
Object leaveChannelsByUrl(botUserid, channelUrl).apiToken(apiToken).execute();
Leave channels - When leaving a channel by its channel URL
Makes a bot leave one or more group channels.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String channelUrl = "channelUrl_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
try {
Object result = api.leaveChannelsByUrl(botUserid, channelUrl)
.apiToken(apiToken)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#leaveChannelsByUrl");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| channelUrl | String | ||
| apiToken | String | [optional] |
Object
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
ListBotsResponse listBots().apiToken(apiToken).token(token).limit(limit).execute();
List bots
Retrieves a list of all bots within an application.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String apiToken = "{{API_TOKEN}}"; // String |
String token = "token_example"; // String |
Integer limit = 56; // Integer |
try {
ListBotsResponse result = api.listBots()
.apiToken(apiToken)
.token(token)
.limit(limit)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#listBots");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| apiToken | String | [optional] | |
| token | String | [optional] | |
| limit | Integer | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
SendBirdBotsMessageResponse sendBotsMessage(botUserid).apiToken(apiToken).sendBotSMessageData(sendBotSMessageData).execute();
Send a bot's message
Sends a bot's message to a channel.
bot_userid
Type: string
Description: Specifies the ID of the bot to send a message.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
SendBotSMessageData sendBotSMessageData = new SendBotSMessageData(); // SendBotSMessageData |
try {
SendBirdBotsMessageResponse result = api.sendBotsMessage(botUserid)
.apiToken(apiToken)
.sendBotSMessageData(sendBotSMessageData)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#sendBotsMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| apiToken | String | [optional] | |
| sendBotSMessageData | SendBotSMessageData | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
UpdateBotByIdResponse updateBotById(botUserid).apiToken(apiToken).updateBotByIdData(updateBotByIdData).execute();
Update a bot
Updates information on a bot.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
UpdateBotByIdData updateBotByIdData = new UpdateBotByIdData(); // UpdateBotByIdData |
try {
UpdateBotByIdResponse result = api.updateBotById(botUserid)
.apiToken(apiToken)
.updateBotByIdData(updateBotByIdData)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#updateBotById");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| apiToken | String | [optional] | |
| updateBotByIdData | UpdateBotByIdData | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |
ViewBotByIdResponse viewBotById(botUserid).apiToken(apiToken).execute();
View a bot
Retrieves information on a bot.
// Import classes:
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.model.*;
import org.sendbird.client.api.BotApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api-APP_ID.sendbird.com");
BotApi apiInstance = new BotApi(defaultClient);
String botUserid = "botUserid_example"; // String |
String apiToken = "{{API_TOKEN}}"; // String |
try {
ViewBotByIdResponse result = api.viewBotById(botUserid)
.apiToken(apiToken)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BotApi#viewBotById");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| botUserid | String | ||
| apiToken | String | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response | - |