This is a Java library that makes talking to the Sendbird Platform API easier. With this library you can extend your Sendbird integration to include advanced features like channel automation and user management.
import org.sendbird.client.ApiClient;
import org.sendbird.client.ApiException;
import org.sendbird.client.Configuration;
import org.sendbird.client.api.UserApi;
import org.openapitools.client.model.ListUsersResponse;
class AppTest {
static class User {
UserApi apiInstance;
public User(ApiClient defaultClient){
apiInstance = new UserApi(defaultClient);
}
public void listUsers(){
try {
Integer limit = 56;
String activeMode = "activated";
Boolean showBot = true;
ListUsersResponse result = apiInstance.listUsers().limit(limit).activeMode(activeMode).execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling listUsers");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
public static void main(String[] args) {
String apiToken = "YOUR_API_TOKEN";
String applicationId = "YOUR_APP_ID_FROM_DASHBOARD";
ApiClient defaultClient = Configuration.getDefaultApiClient().addDefaultHeader("Api-Token", apiToken);
defaultClient.setBasePath("https://api-" + applicationId + ".sendbird.com");
User user = new User(defaultClient);
user.listUsers();
}
}
In order to make requests with this SDK you will need you master API token. This can be found through the Sendbird dashboard. Each app you create in Sendbird has its own master api token. These tokens can be found in Settings > Application > General.
Building the API client library requires:
- Java 1.7+
- Maven (3.8.3+)/Gradle (7.2+)
To install the API client library to your local Maven repository, simply execute:
mvn clean install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer to the OSSRH Guide for more information.
Add these dependency to your project's POM:
<dependencies>
<dependency>
<groupId>org.sendbird</groupId>
<artifactId>sendbird-platform-sdk</artifactId>
<version>1.0.20</version>
</dependency>
</dependencies>
Add this dependency to your project's build file:
dependencies {
implementation "org.sendbird:sendbird-platform-sdk:1.0.20"
}
allprojects {
repositories {
maven { url "https://repo.sendbird.com/public/maven" }
}
}
All the documentation for this project lives in the /docs directory of this repo.
Documentation | |
---|---|
Announcement | docs/AnnouncementApi.md |
Application | docs/ApplicationApi.md |
Bot | docs/BotApi.md |
GroupChannel | docs/GroupChannelApi.md |
Message | docs/MessageApi.md |
OpenChannel | docs/OpenChannelApi.md |
User | docs/UserApi.md |
Webhooks | docs/WebhooksApi.md |