This page describes callbacks of Channel Talk React Native SDK (hereafter referred to as SDK).

onShowMessenger

Invoked when the messenger is shown. Examples are the following:

  • calls showMessenger
  • calls openChat
  • When the user opens messenger through Channel button
ChannelIO.onShowMessenger(() => { });

onHideMessenger

Invoked when the messenger is hidden. Examples are the following:

  • calls hideMessenger
  • calls sleep
  • calls shutdown
  • When the user closes messenger explicitly, such as by clicking the X button.
ChannelIO.onHideMessenger(() => { });

onChatCreated

Invoked when SDK completes creating a new chat. Examples are the following:

  • Explicit creating chat by the user such as by click a [new Chat button]
  • calls openChat with chatId = nil
ChannelIO.onChatCreated((chatId) => { });

onBadgeChanged Deprecated

Invoked when the count of the user’s badge is changed. Examples are the following:

  • boot
  • When the user received the messages or marketing message
ChannelIO.onBadgeChanged((count) => { });

onBadgeChanged

Invoked when the number of notifications changes or at boot. The details of this method's parameters, 'unread', and 'alert' are as follows:

  • unread : The number of all unread notifications the user has. It includes the number of alert. It is displayed as a red dot on the Channel button.
  • alert : The number of important notifications that the user has not read. It is displayed as a number on the Channel button.
ChannelIO.onBadgeChanged((unread, count) => { });

onFollowUpChanged

Invoked when Followup information is changed by the user.
It is not called by ChannelIO.updateUser. Values in dictionaries are nullable.

ChannelIO.onFollowUpChanged((data) => { });

onUrlClicked

Invoked when the user clicks a link in the chat or clicks the link button.
If this method returns true, URL redirection performed by the SDK will not work.

let handleUrl = true;

ChannelIO.onUrlClicked((url, next) => {
	if (!handleUrl) {
		// Use this function if you want to open web view
		next();
	}
});

onPopupDataReceived

Invoked when receiving In-app message popup. Examples are the following:

  • receive the message from the manager
  • receive marketing message

See the PopupData documentation for details on the events that are parameters of this function.

ChannelIO.onPopupDataReceived((popupData) => { });

onPushNotificationClicked

Invoked when a system push notification is clicked. Call next function to use default behavior.
The onPushNotificationClicked callback only works for Android. A call to this function on iOS will be silently ignored.

ChannelIO.onPushNotificationClicked((chatId, next) => { });