module:sendbird

module:sendbird

Represents core SendBird class, this class is a singleton instance initialized by Application ID

Constructor

new (require("sendbird"))(args)

See:

Instantiates SendBird class as a singleton. sendbird.getInstance() always returns the instance instantiated

Parameters:
Name Type Description
args Object

Option object for SendBird instance

Properties
Name Type Description
appId string

Unique app id for SendBird class

Members

(static) LogLevel

Properties:
Name Type Description
VERBOSE string

"verbose"

DEBUG string

"debug"

INFO string

"info"

WARN string

"warn"

ERROR string

"error"

NONE string

"none"

String enum object for describing type of log level

(static) version :string

Current version of SendBird SDK

Type:
  • string

appInfo

Returns application information object

(nullable) currentUser :module:model/user~User

Default Value:
  • null
Type:

ekey

Returns key to authenticate the resource

Options :Options

Type:

PushTriggerOption

Properties:
Name Type Description
ALL string

"all"

MENTION_ONLY string

"mention_only"

OFF string

"off"

String enum object for describing push notifications trigger option

(inner) AdminMessage :module:model/adminMessage~AdminMessage

Type:

(inner) AppleCriticalAlertOptions :module:model/handler/appleCriticalAlertOptions~AppleCriticalAlertOptions

Type:
  • module:model/handler/appleCriticalAlertOptions~AppleCriticalAlertOptions

(inner) BaseMessageParams :module:model/params/baseMessageParams~BaseMessageParams

Type:

(inner) ChannelHandler :module:model/handler/channelHandler~ChannelHandler

Type:

(inner) ConnectionHandler :module:model/handler/connectionHandler~ConnectionHandler

Type:

(inner) FileMessage :module:model/fileMessage~FileMessage

Type:

(inner) FileMessageParams :module:model/params/fileMessageParams~FileMessageParams

Type:

(inner) GroupChannel :module:model/groupChannel~GroupChannel

Type:

(inner) GroupChannelChangeLogsParams :module:model/params/groupChannelChangeLogsParams~GroupChannelChangeLogsParams

Type:

(inner) GroupChannelListQuery :module:model/query/groupChannelListQuery~GroupChannelListQuery

Type:

(inner) GroupChannelParams :module:model/params/groupChannelParams~GroupChannelParams

Type:

(inner) GroupChannelTotalUnreadMessageCountParams :module:model/params/groupChannelTotalUnreadMessageCountParams~GroupChannelTotalUnreadMessageCountParams

Type:

(inner) Member :module:model/member~Member

Type:

(inner) MemberListQuery :module:model/query/memberListQuery~MemberListQuery

Type:

(inner) MessageChangeLogsParams :module:model/params/messageChangeLogsParams~MessageChangeLogsParams

Type:

(inner) MessageListParams :module:model/params/messageListParams~MessageListParams

Type:

(inner) MessageMetaArray :module:model/messageMetaArray~MessageMetaArray

Type:

(inner) MessageRetrievalParams :module:model/params/messageRetrievalParams~MessageRetrievalParams

Type:

(inner) OpenChannel :module:model/openChannel~OpenChannel

Type:

(inner) OpenChannelParams :module:model/params/openChannelParams~OpenChannelParams

Type:

(inner) ScheduledUserMessageParams :module:model/params/scheduledUserMessageParams~ScheduledUserMessageParams

Type:

(inner) SessionHandler :module:model/handler/sessionHandler~SessionHandler

Type:

(inner) ThreadedMessageListParams :module:model/params/threadedMessageListParams~ThreadedMessageListParams

Type:

(inner) User :module:model/user~User

Type:

(inner) UserEventHandler :module:model/handler/userEventHandler~UserEventHandler

Type:

(inner) UserMessage :module:model/userMessage~UserMessage

Type:

(inner) UserMessageParams :module:model/params/userMessageParams~UserMessageParams

Type:

Methods

(static) getInstance() → {module:sendbird}

Returns:
  • instantiated SendBird instance
Type
module:sendbird

(static) getLogLevel() → {string}

Returns log level of the logger

Returns:
Type
string

(static) setLogLevel(logLevel)

Sets log level of the logger

Parameters:
Name Type Description
logLevel string

addChannelHandler(id, handler)

See:

Adds handler to SendBird for channel-related events

Parameters:
Name Type Description
id string
handler module:model/handler/channelHandler~ChannelHandler

addConnectionHandler(id, handler)

See:

Adds handler to SendBird for connection-related events

Parameters:
Name Type Description
id string
handler module:model/handler/connectionHandler~ConnectionHandler

addFriends(userIds, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
userIds Array.<string>
callback userListQueryCallback <optional>
Returns:
Type
Promise | undefined

addUserEventHandler(id, handler)

See:

Adds handler to SendBird for user-related events

Parameters:
Name Type Description
id string
handler module:model/handler/userEventHandler~UserEventHandler

blockUser(user, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
user module:model/user~User
callback userCallback <optional>
Returns:
Type
Promise | undefined

blockUserWithUserId(userId, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
userId string
callback userCallback <optional>
Returns:
Type
Promise | undefined

connect(userId, callbackopt) → {Promise|undefined}

See:

Connects to SendBird server

Parameters:
Name Type Attributes Description
userId string
callback userCallback <optional>
Returns:
Type
Promise | undefined

connect(userId, apiHostnullable, wsHostnullable, callbackopt) → {Promise|undefined}

See:

Connects to SendBird server

Parameters:
Name Type Attributes Description
userId string
apiHost string <nullable>
wsHost string <nullable>
callback userCallback <optional>
Returns:
Type
Promise | undefined

connect(userId, accessTokennullable, callbackopt) → {Promise|undefined}

See:

Connects to SendBird server

Parameters:
Name Type Attributes Description
userId string
accessToken string <nullable>
callback userCallback <optional>
Returns:
Type
Promise | undefined

connect(userId, accessTokennullable, apiHostnullable, wsHostnullable, callbackopt) → {Promise|undefined}

See:

Connects to SendBird server

Parameters:
Name Type Attributes Description
userId string
accessToken string <nullable>
apiHost string <nullable>
wsHost string <nullable>
callback userCallback <optional>
Returns:
Type
Promise | undefined

createApplicationUserListQuery() → {module:model/query/applicationUserListQuery~ApplicationUserListQuery}

Creates a query object for getting a list of all users withing the current application

Returns:
Type
module:model/query/applicationUserListQuery~ApplicationUserListQuery

createBlockedUserListQuery() → {module:model/query/blockedUserListQuery~BlockedUserListQuery}

Creates a query object for getting a list of blocked users by the current user

Returns:
Type
module:model/query/blockedUserListQuery~BlockedUserListQuery

createFriendListQuery() → {module:model/query/friendListQuery~FriendListQuery}

Returns:
Type
module:model/query/friendListQuery~FriendListQuery

createMessageSearchQuery() → {module:model/query/messageSearchQuery~MessageSearchQuery}

Creates a query object for searching messaging by a keyword

Returns:
Type
module:model/query/messageSearchQuery~MessageSearchQuery

createUserListQuery(userIdsopt) → {module:compat/legacy/userListQuery~UserListQuery}

Deprecated:
  • since version v3.0.86, please use createApplicationUserListQuery() instead

Creates a query object for getting a list of users within current application with user IDs

Parameters:
Name Type Attributes Default Description
userIds Array.<string> <optional>
[]
Returns:
Type
module:compat/legacy/userListQuery~UserListQuery

deleteFriend(userId, callback) → {Promise|undefined}

Parameters:
Name Type Description
userId string
callback commonCallback
Returns:
Type
Promise | undefined

deleteFriendDiscoveries(discoveryKeys, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
discoveryKeys Array.<string>
callback commonCallback <optional>
Returns:
Type
Promise | undefined

deleteFriendDiscovery(discoveryKey, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
discoveryKey string
callback commonCallback <optional>
Returns:
Type
Promise | undefined

deleteFriends(userIds, callback) → {Promise|undefined}

Parameters:
Name Type Description
userIds Array.<string>
callback commonCallback
Returns:
Type
Promise | undefined

disableStateChange()

State change should be disabled when image picker is loaded in Android.

disconnect(callbackopt) → {Promise|undefined}

See:

SendBird disconnect. Invalidates currentUser

Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

enableStateChange()

State change should be disabled when image picker is loaded in Android.

getAllEmoji(callback) → {Promise|undefined}

Parameters:
Name Type Description
callback EmojiContainerCallback
Returns:
Type
Promise | undefined

getAllowFriendDiscovery(callback) → {Promise|undefiend}

Gets current friend discovery allow state.

Parameters:
Name Type Description
callback commonCallback
Returns:
Type
Promise | undefiend

getApplicationId() → {string}

Returns App ID of the application

Returns:
Type
string

getChannelInvitationPreference(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

getConnectionState() → {string}

Returns websocket server connection state

Returns:
  • current connection state ConnectionState
Type
string

getCurrentUserId() → (nullable) {string}

Deprecated:
  • since version v3.0.109, please use currentUser instead Returns user id of the current user
Returns:
Type
string

getDoNotDisturb(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

getEmoji(emojiKey, callback) → {Promise|undefined}

Parameters:
Name Type Description
emojiKey string
callback EmojiCallback
Returns:
Type
Promise | undefined

getEmojiCategory(categoryId, callback) → {Promise|undefined}

Parameters:
Name Type Description
categoryId number
callback EmojiCategoryCallback
Returns:
Type
Promise | undefined

getFriendChangeLogsByToken(tokenopt, nullable, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Default Description
token string <optional>
<nullable>
null
callback getFriendChangeLogsByTokenHandler <optional>
Returns:
Type
Promise | undefined

getGroupChannelCount(memberStateFilteropt, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
memberStateFilter string <optional>
callback commonCallback <optional>
Returns:
Type
Promise | undefined

getLastConnectedAt() → {number}

Returns timestamp (UTC) in milliseconds of user's last connection, 0 if not set

Returns:
Type
number

getMyGroupChannelChangeLogsByTimestamp(ts, params, callbackopt) → {Promise|undefined}

Requests updated channels and deleted channel URLs since the timestamp and the results may contain empty channels.

Parameters:
Name Type Attributes Description
ts number
params module:model/params/groupChannelChangeLogsParams~GroupChannelChangeLogsParams
callback getGroupChannelChangeLogsHandler <optional>
Returns:
Type
Promise | undefined

getMyGroupChannelChangeLogsByTimestamp(ts, customTypesnullable, includeEmptynullable, callbackopt) → {Promise|undefined}

Deprecated:
  • since version v3.0.125

Requests updated channels and deleted channel URLs since the timestamp and the results may contain empty channels.

Parameters:
Name Type Attributes Description
ts number
customTypes Array.<string> <nullable>
includeEmpty boolean <nullable>
callback getGroupChannelChangeLogsHandler <optional>
Returns:
Type
Promise | undefined

getMyGroupChannelChangeLogsByTimestamp(ts, customTypesnullable, callbackopt) → {Promise|undefined}

Deprecated:
  • since version v3.0.125

Requests updated channels and deleted channel URLs since the timestamp and the results may contain empty channels.

Parameters:
Name Type Attributes Description
ts number
customTypes Array.<string> <nullable>
callback getGroupChannelChangeLogsHandler <optional>
Returns:
Type
Promise | undefined

getMyGroupChannelChangeLogsByToken(tokennullable, params, callbackopt) → {Promise|undefined}

Requests updated channels and deleted channel URLs since a certain time. A certain time is decided by token and the results may contain empty channels

Parameters:
Name Type Attributes Description
token string <nullable>
params module:model/params/groupChannelChangeLogsParams~GroupChannelChangeLogsParams
callback getGroupChannelChangeLogsHandler <optional>
Returns:
Type
Promise | undefined

getMyGroupChannelChangeLogsByToken(tokennullable, customTypesnullable, includeEmptynullable, callbackopt) → {Promise|undefined}

Deprecated:
  • since version v3.0.125

Requests updated channels and deleted channel URLs since a certain time. A certain time is decided by token and the results may contain empty channels

Parameters:
Name Type Attributes Description
token string <nullable>
customTypes Array.<string> <nullable>
includeEmpty boolean <nullable>
callback getGroupChannelChangeLogsHandler <optional>
Returns:
Type
Promise | undefined

getMyGroupChannelChangeLogsByToken(tokennullable, customTypesnullable, callbackopt) → {Promise|undefined}

Deprecated:
  • since version v3.0.125

Requests updated channels and deleted channel URLs since a certain time. A certain time is decided by token and the results may contain empty channels

Parameters:
Name Type Attributes Description
token string <nullable>
customTypes Array.<string> <nullable>
callback getGroupChannelChangeLogsHandler <optional>
Returns:
Type
Promise | undefined

getMyPushTokensByToken(token, type, callbackopt) → {Promise|undefined}

Requests device push tokens list of the current user.

Parameters:
Name Type Attributes Description
token string
type string

one of "gcm" | "apns" | "apns_voip"

callback getMyPushTokensHandler <optional>
Returns:
Type
Promise | undefined

getPendingAPNSToken() → {string}

Returns:
Type
string

getPendingGCMToken() → {string}

Returns:
Type
string

getPushTemplate(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback pushSettingCallback <optional>
Returns:
Type
Promise | undefined

getPushTriggerOption(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback getPushTriggerOptionCallback <optional>
Returns:
Type
Promise | undefined

getSnoozePeriod(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

getSubscribedCustomTypeTotalUnreadMessageCount() → {number}

Returns:
Type
number

getSubscribedCustomTypeUnreadMessageCount(customType) → {number}

Parameters:
Name Type Description
customType string
Returns:
Type
number

getSubscribedTotalUnreadMessageCount() → {number}

Returns:
Type
number

getTotalUnreadChannelCount(callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
callback groupChannelCountCallback <optional>
Returns:
Type
Promise | undefined

getTotalUnreadMessageCount(channelCustomTypesFilter, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
channelCustomTypesFilter module:model/params/groupChannelTotalUnreadMessageCountParams~GroupChannelTotalUnreadMessageCountParams
callback groupChannelCountCallback <optional>
Returns:
Type
Promise | undefined

getTotalUnreadMessageCount(callbackopt) → {Promise|undefined}

Deprecated:
  • since version v3.0.80, please use getTotalUnreadMessageCount() instead
See:
Parameters:
Name Type Attributes Description
callback groupChannelCountCallback <optional>
Returns:
Type
Promise | undefined

getTotalUnreadMessageCount(channelCustomTypesFilter, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
channelCustomTypesFilter Array.<string>
callback groupChannelCountCallback <optional>
Returns:
Type
Promise | undefined

getUnreadItemCount(keys, callbackopt) → {Promise|undefined}

Get count of unread messages and invitations in super and non-super channels

Parameters:
Name Type Attributes Description
keys Array.<string>
callback commonCallback <optional>
Returns:
Type
Promise | undefined

markAsDelivered(channelUrl)

Parameters:
Name Type Description
channelUrl string

markAsReadAll(callback) → {Promise|undefined}

Marks all group channels of the current user as read

Parameters:
Name Type Description
callback commonCallback
Returns:
Type
Promise | undefined

markAsReadWithChannelUrls(channelUrls, callbackopt) → {Promise|undefined}

Marks specified groups as read by the current user

Parameters:
Name Type Attributes Description
channelUrls Array.<string>
callback commonCallback <optional>
Returns:
Type
Promise | undefined

reconnect() → {boolean}

See:

SendBird manual reconnect method, you can also enable auto-reconnect feature

Returns:
  • false if user is not logged in
Type
boolean

registerAPNSPushTokenForCurrentUser(token, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
token string
callback pushSettingCallback <optional>
Returns:
Type
Promise | undefined

registerGCMPushTokenForCurrentUser(token, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
token string
callback pushSettingCallback <optional>
Returns:
Type
Promise | undefined

removeAllChannelHandlers()

See:

removeAllConnectionHandlers()

See:

removeAllUserEventHandler()

See:

removeChannelHandler(id)

See:
Parameters:
Name Type Description
id string

removeConnectionHandler(id)

See:
Parameters:
Name Type Description
id string

removeUserEventHandler(id)

See:
Parameters:
Name Type Description
id string

setAllowFriendDiscovery(allowFrienDiscovery, callback) → {Promise|undefined}

Sets friend discovery allow state.

Parameters:
Name Type Description
allowFrienDiscovery boolean
callback commonCallback
Returns:
Type
Promise | undefined

setBackgroundState()

Sets AppState into background (React Native/Ionic)

setChannelInvitationPreference(isAutoAccept, callback) → {Promise|undefined}

See:
Parameters:
Name Type Description
isAutoAccept boolean
callback commonCallback
Returns:
Type
Promise | undefined

setDoNotDisturb(doNotDisturbOn, startHour, startMin, endHour, endMin, timezone, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
doNotDisturbOn boolean
startHour number
startMin number
endHour number
endMin number
timezone string
callback commonCallback <optional>
Returns:
Type
Promise | undefined

setErrorFirstCallback(val)

Set to true if an error object should come first in a parameter list of callbacks. Default value is false for a SendBird instance

Parameters:
Name Type Description
val boolean

setForegroundState()

Sets AppState into foreground (React Native/Ionic)

setPushTemplate(templateName, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
templateName string
callback pushSettingCallback <optional>
Returns:
Type
Promise | undefined

setPushTriggerOption(pushTriggerOption, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
pushTriggerOption string

one of "all" | "mention_only" | "off"

callback commonCallback <optional>
Returns:
Type
Promise | undefined

setSessionHandler(handler)

Sets handler to SendBird for session-related events

Parameters:
Name Type Description
handler module:model/handler/sessionHandler~SessionHandler

setSnoozePeriod(snoozeOn, startTs, endTs, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
snoozeOn boolean
startTs number
endTs number
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unblockUser(user, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
user module:model/user~User
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unblockUserWithUserId(userId, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
userId string
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unregisterAPNSPushTokenAllForCurrentUser(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unregisterAPNSPushTokenForCurrentUser(token, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
token string
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unregisterGCMPushTokenAllForCurrentUser(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unregisterGCMPushTokenForCurrentUser(token, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
token string
callback commonCallback <optional>
Returns:
Type
Promise | undefined

unregisterPushTokenAllForCurrentUser(callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
callback commonCallback <optional>
Returns:
Type
Promise | undefined

updateCurrentUserInfo(nicknamenullable, profileUrlnullable, callbackopt) → {Promise|undefined}

See:
Parameters:
Name Type Attributes Description
nickname string <nullable>
profileUrl string <nullable>
callback userCallback <optional>
Returns:
Type
Promise | undefined

updateCurrentUserInfoWithPreferredLanguages(preferredLanguages, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
preferredLanguages Array.<string>
callback userCallback <optional>
Returns:
Type
Promise | undefined

updateCurrentUserInfoWithProfileImage(nicknamenullable, profileImagenullable, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
nickname string <nullable>
profileImage File <nullable>
callback userCallback <optional>
Returns:
Type
Promise | undefined

uploadFriendDiscoveries(discoveries, callbackopt) → {Promise|undefined}

Parameters:
Name Type Attributes Description
discoveries DiscoveryObject
callback commonCallback <optional>
Returns:
Type
Promise | undefined