Properties

Accessors

Methods

init addConnectionHandler addExtension addFriends addSendbirdExtensions addUserEventHandler authenticate authenticateFeed blockUser blockUserWithUserId buildUserFromSerializedData clearCachedData clearCachedMessages connect createApplicationUserListQuery createBlockedUserListQuery createFriendListQuery createMessageSearchQuery createPollListQuery createPollVoterListQuery deleteFriend deleteFriendDiscoveries deleteFriendDiscovery deleteFriends disconnect disconnectWebSocket getAllEmoji getAllowFriendDiscovery getCacheDataSize getChannelInvitationPreference getDoNotDisturb getEmoji getEmojiCategory getFriendChangeLogsByToken getMemoryStoreForDebugging getMyPushTokensByToken getPushTemplate getPushTriggerOption getReportCategoryInfoList getSnoozePeriod getUIKitConfiguration initializeCache markPushNotificationAsClicked markPushNotificationAsDelivered reconnect registerAPNSPushTokenForCurrentUser registerFCMPushTokenForCurrentUser removeAllConnectionHandler removeAllUserEventHandler removeConnectionHandler removeUserEventHandler setAllowFriendDiscovery setBackgroundState setChannelInvitationPreference setDoNotDisturb setForegroundState setLocaleForChatbot setOfflineListener setOnlineListener setPushTemplate setPushTriggerOption setSessionHandler setSnoozePeriod unblockUser unblockUserWithUserId unregisterAPNSPushTokenAllForCurrentUser unregisterAPNSPushTokenForCurrentUser unregisterFCMPushTokenAllForCurrentUser unregisterFCMPushTokenForCurrentUser updateCurrentUserInfo updateCurrentUserInfoWithPreferredLanguages uploadFriendDiscoveries

Properties

message: MessageModule

Represents operation options.

Accessors

  • get instance(): default
  • Returns default

    An active SendbirdChat instance.

  • get version(): string
  • Returns string

    Current SDK version.

  • get apnsPushToken(): null | string
  • Returns null | string

    Current APNS push token given to registerAPNSPushTokenForCurrentUser().

  • get appId(): string
  • Returns string

    Current application ID.

  • get appInfo(): null | AppInfo
  • Returns null | AppInfo

    Represents information obtained from the application settings.

  • get appVersion(): string
  • Returns string

    The customer app version to log by the app version.

  • get currentUser(): null | User
  • Returns null | User

    The current connected User. null if connect is not called.

  • get debugMode(): boolean
  • Returns boolean

    Debug mode: showing console logs, using memory database, etc.

  • get ekey(): string
  • Returns string

    The key to authenticate the url retrieved from FileMessage.plainUrl, User.plainProfileImageUrl and Thumbnail.plainUrl. This key has to be put into the HTTP header to access the url provided by above methods.

  • get fcmPushToken(): null | string
  • Returns null | string

    Current FCM push token given to registerFCMPushTokenForCurrentUser().

  • get isCacheEnabled(): boolean
  • Returns boolean

    Whether the app uses local caching.

  • get lastConnectedAt(): number
  • Returns number

    The last connected timestamp.

  • get logLevel(): LogLevel
  • Returns LogLevel

    LogLevel for Sendbird.

  • set logLevel(val): void
  • Parameters

    Returns void

Methods

  • Parameters

    Returns void

    Adds a connection handler. All added handlers will be notified when events occurs.

  • Parameters

    • key: string
    • version: string

    Returns void

    To send additional User-Agent information please set the version information. This will be set pre-defined keys only.

  • Parameters

    • userIds: string[]

    Returns Promise<User[]>

    Add friends.

  • Parameters

    Returns boolean

    Internal purpose. DO NOT USE it for customers.

  • Parameters

    Returns void

    Adds a user event handler. All added handlers will be notified when events occur.

  • Parameters

    • userId: string
    • OptionalauthToken: string

    Returns Promise<User>

    If you want to use the interface without websocket connection, we'd recommend to authenticate using this function instead of SendbirdChat.connect.

  • Parameters

    • userId: string
    • OptionalauthToken: string

    Returns Promise<User>

    since version v4.13.0

  • Parameters

    • userOrUserId: string | User

    Returns Promise<void>

    Blocks the specified User. Blocked User cannot send messages to the blocker.

  • Parameters

    • userId: string

    Returns Promise<void>

    Blocks the specified User with userId. Blocked User cannot send messages to the blocker.

  • Parameters

    • serialized: object

    Returns User

    Makes a User from User-serialized object.

  • Returns Promise<void>

    Clears the database used for local caching.

  • Parameters

    • channelUrls: string[]

    Returns Promise<void>

    Clears cached messages of specific channel.

  • Parameters

    • userId: string
    • OptionalauthToken: string

    Returns Promise<User>

    Connects to SendbirdChat with given User ID and auth token. If you have created Users without auth token, you could ignore authToken.

  • Parameters

    • userId: string

    Returns Promise<void>

    Deletes a friend.

  • Parameters

    • discoveryKeys: string[]

    Returns Promise<void>

    Deletes friend discoveries.

  • Parameters

    • discoveryKey: string

    Returns Promise<void>

    Deletes friend discovery.

  • Parameters

    • userIds: string[]

    Returns Promise<void>

    Deletes friends.

  • Returns Promise<void>

    Disconnects from SendbirdChat.

  • Returns Promise<void>

    Disconnects the WebSocket connection only. It does not clear the currentUser and cached data. If you want to logout, call disconnect.

  • Returns Promise<boolean>

    Gets friend discoverability of current user.

  • Returns Promise<number>

    Gets the size of cached data. Returns 0 if local cache is disabled.

  • Returns Promise<InvitationPreference>

    Gets the current User's preference for GroupChannel join. If this is set as true, the User will automatically join the GroupChannel. If set as false, the User can join the GroupChannel by calling GroupChannel.acceptInvitation() or decline the invitation by calling GroupChannel.declineInvitation().

  • Parameters

    • emojiKey: string

    Returns Promise<Emoji>

    Requests the emoji.

  • Parameters

    • categoryId: number

    Returns Promise<EmojiCategory>

    Requests the emoji category.

  • Parameters

    • token: string

      A pagination token

    Returns Promise<FriendChangelogs>

    Gets friend changelogs by token.

  • Returns null | MemoryStore

    MemoryStore

    (Debug mode only) Get the raw data store.

  • Parameters

    Returns Promise<PushTokens>

    Gets all the push tokens registered to this User.

  • Returns Promise<PushTemplate>

    Gets push template option for the current User. For details of push template option, refer to setPushTemplate. This can be used, for instance, when you need to check the push notification content preview is on or off at the moment.

  • Returns Promise<PushTriggerOption>

    Gets the current User's push trigger option. Refer to PushTriggerOption. For details of push trigger option, refer to setPushTriggerOption.

  • Returns Promise<SnoozePeriod>

    Gets snooze period for the current User.

  • Returns Promise<UIKitConfiguration>

  • Parameters

    • userId: string

    Returns Promise<void>

    Initializes local cache database.

  • Mark push notification as clicked for push delivery tracking purpose only.

    Parameters

    • pushData: Record<string, unknown>

      The payload data from the push notification.

    Returns Promise<void>

  • Mark push notification as delivered for push delivery tracking purpose only.
    This does not mark the message as delivered.
    Marking the message as delivered can be done by [GroupChannelModule.markAsDelivered].

    Parameters

    • pushData: Record<string, unknown>

      The payload data from the push notification.

    • allowedPushNotification: boolean = true

      Only for Android, the POST_NOTIFICATIONS permission.

    Returns Promise<void>

  • Returns boolean

    Tries reconnection with previously and successfully connected user information. This can be called in ConnectionHandler.onReconnectFailed or where you check the device network status to let the SDK try reconnection. ConnectionHandler.onReconnectStarted will be called after you call this (note that it will not be called if there is previously started connection process which has not finished), and ConnectionHandler.onReconnectFailed or ConnectionHandler.onReconnectSucceeded will be called according to the connection status afterwards.

    Usually, the SDK automatically retries connection process when the network connection is lost with some backoff period. When you call this method, you can start connection process immediately.

  • Returns void

    Removes all connection handlers added by addConnectionHandler.

  • Returns void

    Removes all user event handlers added by addUserEventHandler.

  • Parameters

    • key: string

    Returns void

    Removes a connection handler for the key. The deleted handler no longer be notified.

  • Parameters

    • key: string

    Returns void

    Removes a user event handler for the key. The deleted handler no longer be notified.

  • Parameters

    • allowFriendDiscovery: boolean

    Returns Promise<boolean>

    Sets friend discoverability of current user.

  • Returns void

    Sets the SDK as background mode. It closes WebSocket connection but keeps the currentUser and cached data.

  • Parameters

    • willAutoAccept: boolean

    Returns Promise<InvitationPreference>

    Sets the current User's preference for GroupChannel join. If this is set as true, the User will automatically join the GroupChannel. If set as false, the User can join the GroupChannel by calling GroupChannel.acceptInvitation() or decline the invitation by calling GroupChannel.declineInvitation().

  • Parameters

    • doNotDisturbOn: boolean
    • startHour: number = 0
    • startMin: number = 0
    • endHour: number = 0
    • endMin: number = 0
    • timezone: string = ''

    Returns Promise<DoNotDisturbPreference>

    Sets Do-not-disturb option for the current User. If this option is enabled, the current User does not receive push notification during the specified time repeatedly. If you want to snooze specific period, use setSnoozePeriod.

  • Returns void

    Recovers the SDK from the background mode. It re-establishes WebSocket connection for the currentUser.

  • Parameters

    • locale: string

    Returns void

    DO NOT USE, Sets the locale for the chatbot.

  • Parameters

    Returns void

    Sets custom offline status detection handler.

  • Parameters

    Returns void

    Sets custom online status detection handler.

  • Parameters

    Returns Promise<PushTemplate>

    Sets push template option for the current User. The only valid arguments for template name are PUSH_TEMPLATE_DEFAULT and PUSH_TEMPLATE_ALTERNATIVE. If PUSH_TEMPLATE_DEFAULT is set, the push notification will contain the original message in the message field of the push notification. If PUSH_TEMPLATE_ALTERNATIVE is set, message of push notification will be replaced by the content you've set on SendbirdChat Dashboard.

  • Parameters

    Returns Promise<PushTriggerOption>

    Sets the current User's push trigger option. If certain channel's push trigger option is set to GroupChannel.PushTriggerOption.DEFAULT, it works according to the state of PushTriggerOption. If not, push messages will be triggered according to the state of GroupChannel.PushTriggerOption. Refer to GroupChannel.PushTriggerOption.

  • Parameters

    Returns void

    Set a SessionHandler which is required for SDK refresh the session when the current session expires.

  • Parameters

    • snoozeOn: boolean
    • startTs: number = 0
    • endTs: number = 0

    Returns Promise<SnoozePeriod>

    Sets snooze period for the current User. If this option is enabled, the current User does not receive push notification during the given period. It's not a repetitive operation. If you want to snooze repeatedly, use setDoNotDisturb.

  • Parameters

    • userOrUserId: string | User

    Returns Promise<void>

    Unblocks the specified User. Unblocked User can send messages to the ex-blocker.

  • Parameters

    • userId: string

    Returns Promise<void>

    Unblocks the specified User with userId. Unblocked User can send messages to the ex-blocker.

  • Returns Promise<void>

    Deregister all APNS push tokens for the user.

  • Returns Promise<void>

    Deregister all FCM push tokens for the user.

  • Parameters

    Returns Promise<User>

    Updates current User's information.

  • Parameters

    • preferredLanguages: string[]

    Returns Promise<User>

    Updates current User's preferred language.

  • Parameters

    Returns Promise<string>

    A friend discovery request ID.

    Uploads friend discoveries.