Sendbird’s chat API, voice API, & video API, native Chat SDKs, feature-rich platform, and pre-fab UI components make developers more productive. We take care of a ton of operational complexity under the hood, so you can power a rich chat service, and life-like voice, and video experiences, and not worry about features, edge cases, reliability, or scale.
Check out our docslet initParams = InitParams(applicationId: appId)
SendbirdChat.initialize(params: initParams)
SendbirdChat.addChannelDelegate(self, identifier: delegateId)
SendbirdChat.connect(userId: userId) { user, error in
// Get channel
GroupChannel.getChannel(url: channelURL) { channel, error in
// Send message
channel?.sendUserMessage(message) { message, error in
// Message sent
}
}
}
SendbirdChat.init(
InitParams(APP_ID, applicationContext, useCaching = true),
object : InitResultHandler {
override fun onMigrationStarted() {
Log.i("Application", "Called when there's an update in Sendbird server.")
}
override fun onInitFailed(e: SendbirdException) {
Log.i("Application", "Called when initialize failed. SDK will still operate properly as if useLocalCaching is set to false.")
}
override fun onInitSucceed() {
Log.i("Application", "Called when initialization is completed.")
}
}
)
SendbirdChat.addChannelHandler(handlerId, object : GroupChannelHandler() {
override fun onMessageReceived(channel: BaseChannel, message: BaseMessage) {
// message received
}
}
SendbirdChat.connect(userId) { user, e ->
if (user != null) {
if (e != null) {
// Proceed in offline mode with the data stored in the local database.
// Later, connection is made automatically.
// and can be notified through ConnectionHandler.onReconnectSucceeded().
} else {
// Proceed in online mode.
}
GroupChannel.getChannel(channelUrl) { groupChannel, e ->
if (e != null || groupChannel == null) {
// Handle error.
return@getChannel
}
groupChannel.sendUserMessage(
UserMessageCreateParams(message)
) { userMessage, e ->
}
}
} else {
// Handle error.
}
}
const sb = SendbirdChat.init({
appId : 'YOUR-APP-ID',
modules: [
new GroupChannelModule()
]
});
sb.groupChannel.addGroupChannelHandler(handlerId, new GroupChannelHandler({
onMessageReceived: (channel, message) => {
// message received
}
}));
const user = await sb.connect(userId);
const channel = await sb.groupChannel.getChannel(channelUrl);
channel.sendUserMessage({ message })
.onPending((message) => {
// message is pending to be sent
})
.onSucceeded((message) => {
// message sent
})
.onFailed((err, message) => {
// message not sent
});
void main() async {
SendbirdChat.init(appId: 'APP-ID');
SendbirdChat.addChannelHandler('HANDLER-ID', MyGroupChannelHandler());
runZonedGuarded(() async {
final user = await SendbirdChat.connect('USER-ID');
final groupChannel = await GroupChannel.getChannel('CHANNEL-URL');
groupChannel.sendUserMessage(
UserMessageCreateParams(message: 'MESSAGE'),
handler: (message, e) {
// message sent
},
);
}, (e, s) {
// handle error
});
}
class MyGroupChannelHandler extends GroupChannelHandler {
@override
void onMessageReceived(BaseChannel channel, BaseMessage message) {
// message received
}
}
SendbirdClient.Init(appId);
const SendbirdClient.ChannelHandler channelHandler = new SendbirdClient.ChannelHandler();
channelHandler.OnMessageReceived = (BaseChannel baseChannel, BaseMessage baseMessage) => {
// message received
};
SendbirdClient.AddChannelHandler(handlerId, channelHandler);
SendbirdClient.Connect(userId, (User user, SendbirdException connectException) => {
// get channel
GroupChannel.GetChannel(channelUrl,
(GroupChannel groupChannel, SendbirdException getChannelException) => {
// send message
groupChannel.SendUserMessage(message,
(UserMessage userMessage, SendbirdException sendMessageException) => {
// message sent
});
});
});
SendbirdClient.Init(appId);
const SendbirdClient.ChannelHandler channelHandler = new SendbirdClient.ChannelHandler();
channelHandler.OnMessageReceived = (BaseChannel baseChannel, BaseMessage baseMessage) => {
// message received
};
SendbirdClient.AddChannelHandler(handlerId, channelHandler);
SendbirdClient.Connect(userId, (User user, SendbirdException connectException) => {
// get channel
GroupChannel.GetChannel(channelUrl,
(GroupChannel groupChannel, SendbirdException getChannelException) => {
// send message
groupChannel.SendUserMessage(message,
(UserMessage userMessage, SendbirdException sendMessageException) => {
// message sent
});
});
});
import requests
# Send a message
response = requests.request(
method='POST',
url=f'https://api-{YOUR_APP_ID}.sendbird.com/v3/group_channels/{channel_url}/messages',
headers={
'Api-Token': API_TOKEN,
},
json={
'message_type': 'MESG',
'user_id': 'user-1',
'message': 'Hello Sendbird!',
},
)