Chatzora Docs
Developers

React Native SDK

Show your assistant inside your own React Native or Expo app.

This page is for developers who build their own mobile app. To answer customers from your phone, use the Chatzora mobile app instead. See Reply to customers yourself.

The @chatzora/react-native-sdk package shows your hosted chat page inside a react-native-webview view. It works on iOS and Android.

Install

npm install @chatzora/react-native-sdk react-native-webview

With Expo, install the WebView with Expo's installer so the version matches your SDK:

npx expo install react-native-webview

Usage

import React from 'react';
import { SafeAreaView, StyleSheet } from 'react-native';
import { ChatzoraWidget } from '@chatzora/react-native-sdk';

export default function ChatScreen() {
  return (
    <SafeAreaView style={styles.container}>
      <ChatzoraWidget
        agentId="YOUR_ASSISTANT_ID"
        apiBase="https://chatzora.com"
        themeColor="#10b981"
        dataTitle="Support"
      />
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1 },
});

You can copy this code with your assistant ID filled in from Integrations → Mobile React Native SDK.

Props

PropTypeRequiredDescription
agentIdstringYesYour assistant ID.
visitorIdstringNoA stable ID for the user, such as your customer ID. If you leave it out, the chat page creates one.
themeColorstringNoOverrides the theme color saved in the dashboard, for example #10b981.
dataTitlestringNoOverrides the chat title saved in the dashboard.
apiBasestringNoChatzora address. Defaults to https://chatzora.com.
styleViewStyleNoStyle for the container view.
onClose() => voidNoCalled when the user taps the close button in the chat.
onMessageReceived(event: WebViewMessageEvent) => voidNoReceives other messages posted by the chat page, such as new chat messages. Messages from other origins are ignored.

Your assistant must be live for the chat to work. Conversations from the SDK appear in Conversations and count toward your monthly messages.

On this page