Callbacks

This page describes callbacks of ChannelIO 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

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) => { });

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) => { });