Skip to content

sendbird/sendbird-platform-sdk-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sendbird banner image

link to docs NPM

This is a Node.js package written in Typescript that makes talking to the Sendbird Platform API easier. With this library you can extend your Sendbird integration to include advanced features like message-, and channel automation, user management, create user authentication tokens, and create bots.

🔥 Quick start

import {
  createConfiguration,
  ServerConfiguration,
  UserApi,
  UserApiCreateAUserRequest,
  UserApiListUsersRequest,
} from "sendbird-platform-sdk-typescript";

const APP_ID = "YOUR_APP_ID_FROM_DASHBOARD";
const API_TOKEN = "YOUR_MASTER_API_TOKEN_FROM_DASHBOARD";

const serverConfig = new ServerConfiguration(
  `https://api-${APP_ID}.sendbird.com`,
  { app_id: APP_ID }
);
const configuration = createConfiguration({
  baseServer: serverConfig,
});
const userApi = new UserApi(configuration);

const listUsersParams: UserApiListUsersRequest = {
  limit: 10,
  apiToken: API_TOKEN,
};

const users = await userApi.listUsers(listUsersParams);
console.log("Listing first 10 users:\n", users);

const createUserParams: UserApiCreateAUserRequest = {
  createAUserRequest: {
    userId: "bob_smith",
    nickname: "Bob",
    profileUrl: "https://cataas.com/c",
  },
  apiToken: API_TOKEN,
};

const user = await userApi.createAUser(createUserParams);
console.log("User created:\n", user);

⚠️ Warnings

  1. This library is intended for server to server requests. Do not use in a browser environment. This SDK uses the Master API Token, which must never be exposed in public environments such as web pages or apps.

⚒️ Prerequisite

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. how to find you api token

💻 Requirements

You will need Node.js installed. This has been developed and tested with NodeJS 17+.

📦 Installation

You can install the SDK directly from npm:

# Using npm
npm install sendbird-platform-sdk-typescript

# Using yarn
yarn add sendbird-platform-sdk-typescript

⚠️ This SDK is intended for the server-side environment only. Do not use this in browsers or frontend applications.

🤓 Local Development

  1. Clone the repository
  2. cd to the sendbird-platform-sdk-typescript directory
  3. run npm install
  4. cd to your project directory
  5. run npm install /path/to/sendbird-platform-sdk-typescript --save

🗃️ Documentation

All the documentation for this project lives in the root directory of this repo.

Helpful links
Documentation
Announcement AnnouncementApi.md
Bot BotApi.md
GroupChannel GroupChannelApi.md
Message MessageApi.md
OpenChannel OpenChannelApi.md
User UserApi.md

About

Sendbird Typescript SDK for the server to server API

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 8