Docs menu

React Native SDK

React Native SDK API reference

Every export of @mentiora-ai/react-native-sdk.

Everything below is exported from @mentiora-ai/react-native-sdk.

Mentiora

Method
configure(config)Sets the options below. Throws on a malformed widgetUrl.
open({ threadId? })Shows the chat, on a thread if given. Waits for configure() and <MentioraHost />.
close()Hides the chat and keeps it loaded.
logout()Starts a new anonymous user, clears the token and reloads. Returns a promise. Throws before configure().
getInstallRef()Promise of the anonymous user's webhook key, or null before the first open.
isMentioraPush(data)Whether a push data block is Mentiora's.
handleNotificationTap(data)Opens the thread of a Mentiora push and returns true. Returns false for any other push.

Components

Component
<MentioraHost />The overlay that Mentiora.open() shows. Mount it once, as the last child of your app root.
<MentioraWidget />The chat inline in your layout. Takes the options below plus visible (default true).

Options

Option
widgetUrlRequired. https://widget.<your-workspace>.mentiora.ai/h/rn/<embed key>.
identity{ getToken } or { endpoint, headers?, body? }. Leave out for anonymous chat. See Identify users.
onEventCalled with every event.
onOpenUrlReturn true to handle a link yourself.
storageReplaces AsyncStorage for the anonymous user id: async getItem, setItem and removeItem.
stringsError screen text: errorTitle, errorBody, retry, dismiss.
renderErrorReplaces the error screen. Receives { code, retry, dismiss }.

Types

MentioraConfig, MentioraEvent, MentioraIdentity, MentioraIdentityCallback, MentioraIdentityFetcher, MentioraWidgetProps, MentioraStorage, MentioraStrings, MentioraErrorCode, MentioraErrorRenderProps and StorageUnavailableReason. SDK_NAME and SDK_VERSION are exported as constants.