Add a Conversation to React-Native app

The OpenWeb SDK exposes one major flow to set up. When the PreConversation view is loaded, a user sees the following displayed below an article in the article view controller:

  • Preview of 2 comments from the conversation
  • Text box to create new comments
  • Button to show all comments

If a user clicks the button to see more comments, the SDK opens a new ViewController which displays all comments from the conversation.

If a user clicks on the text box, the creation screen appears to enable the user to type a comment. To post new comments, the user must be logged in.

Use the following steps to initialize the SDK and configure the Conversation:

    1. Import the OpenWeb modules

import { SpotIM, SpotIMEventEmitter, SpotIMAPI } from ''

    2. Initialize OpenWeb SDK with your Spot_ID in your root component constructor


    3.Load PreConversation View in React-Native

    style={{flex: 1}}

Dark Mode support


By default, dark mode is false.
To support dark mode according to the device settings, use supportAndroidSystemDarkMode prop:


In order to force turning on / off dark mode, use androidIsDarkMode prop:


Make sure that supportAndroidSystemDarkMode is not set to true. Otherwise, androidIsDarkMode prop won't work.


By default, dark mode will be enabled according to the device settings.
In order to force turning on / off dark mode, use the method:



Call the OpenWeb logout API whenever a user logs out of your system.


Login status

The OpenWeb login status API enables you to understand the status of the current OpenWeb user.

    .then(status => {
    .catch(error => {
Login statusDescription
GuestUnregistered guest user

You should call startSSO / sso("<SECRET_JWT>") if your own login status is 'user is logged in'.
LoggedInRegistered OpenWeb user

You should avoid calling startSSO / sso("<SECRET_JWT>") in this case. If you own status is 'user is logged out', call the OpenWeb logout method.

Analytics event callback

You can receive the OpenWeb analytics event by subscribing to trackAnalyticsEvent event.

onTrackAnalyticsEvent(event) {
    console.log('\n', event.type, '\n', event);

componentDidMount() {
    const subscription = SpotIMEventEmitter.addListener('trackAnalyticsEvent', this.onTrackAnalyticsEvent);

Did this page help you?