In-App Chat

This page covers the APIs specific to in-app chats for React-Native apps.

In-App Notifications

By default, a notification will be shown on top of your app's UI when a new message is received.

Disabling In-App Notifications

You can disable the in-app notifications as in the following example.

Instabug.setChatNotificationEnabled(false);

Get Unread Messages Count

Instabug.getUnreadMessagesCount((count) => {
  Alert.alert("UnReadMessages", "Messages: " + count);
});

SDK Events

New Received Message

This block is executed each time a new message is received. This can be used to show your own UI when a new message is received when default chat notifications are disabled.

Instabug.setOnNewMessageHandler(function () {
    //Create custom alert
});

Disabling and Enabling

Bug reporting, feedback, and chats can be enabled or disabled separately. When the user invokes the SDK with any of the invocation events, a popup appears showing all the enabled features. When only a single option is enabled, it becomes the default invocation mode and the popup doesn't appear. If all options are disabled, bug reporting becomes the default invocation mode.

//Arguments: chat, bug, feedback
BugReporting.setPromptOptionsEnabled(false, true, true);

By default, all three options for In-App Chats are enabled if they are available in your current plan.