SBDMain.initWithApplicationId(appId)
SBDMain.connectWithUserId(userId, completionHandler: {
(user:SBDUser?, err:SBDError?) in
SBDMain.addChannelDelegate(self, identifier:handlerId)
// get channel
SBDGroupChannel.getChannelWithUrl(channelUrl, completionHandler: {
(channel:SBDGroupChannel?, err:SBDError?) in
// send message
channel?.sendUserMessage(message, completionHandler: {
(message:SBDUserMessage?, err:SBDError?) in
// message sent
})
})
})
override func channel(sender: SBDBaseChannel,
didReceiveMessage message: SBDBaseMessage) {
// message received
}
Sendbird.init(appId, context);
Sendbird.addChannelHandler(handlerId, new Sendbird.ChannelHandler() {
@Override
public void onMessageReceived(BaseChannel baseChannel, BaseMessage baseMessage) {
// message received
}
});
Sendbird.connect(userId, new ConnectHandler() {
@Override
public void onConnected(User user, SendbirdException e) {
// get channel
GroupChannel.getChannel(channelUrl, new GroupChannel.GroupChannelGetHandler() {
@Override
public void onResult(GroupChannel groupChannel, SendbirdException e) {
// send message
groupChannel.sendUserMessage(message,
new BaseChannel.SendUserMessageHandler() {
@Override
public void onSent(UserMessage userMessage, SendbirdException e) {
// message sent
}
});
}
});
}
});
const sb = new Sendbird({ appId : 'YOUR-APP-ID' });
const channelHandler = new sb.ChannelHandler();
channelHandler.onMessageReceived = (channel, message) => {
// message received
};
sb.addChannelHandler(handlerId, channelHandler);
sb.connect(userId, (user, err) => {
// get channel
sb.GroupChannel.getChannel(channelUrl, (channel, err) => {
// send message
channel.sendUserMessage(message, (message, err) => {
// 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
});
});
});
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 os
import requests
api_headers = {'Api-Token': '{api_token}'}
data = {
'user_id': 'userId',
'nickname': 'nickname',
'issue_access_token': True
}
filepath = os.path.join(os.path.dirname(__file__), '{file_path}', '{file_name}')
upload_files = {'profile_file': ('{file_name}', open(filepath, 'rb'))}
res = requests.post('http://{region_identifier}.sendstage.wpengine.com/v3/users',
headers = api_headers,
data = data,
files = upload_files)