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-webviewWith Expo, install the WebView with Expo's installer so the version matches your SDK:
npx expo install react-native-webviewUsage
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
| Prop | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Your assistant ID. |
visitorId | string | No | A stable ID for the user, such as your customer ID. If you leave it out, the chat page creates one. |
themeColor | string | No | Overrides the theme color saved in the dashboard, for example #10b981. |
dataTitle | string | No | Overrides the chat title saved in the dashboard. |
apiBase | string | No | Chatzora address. Defaults to https://chatzora.com. |
style | ViewStyle | No | Style for the container view. |
onClose | () => void | No | Called when the user taps the close button in the chat. |
onMessageReceived | (event: WebViewMessageEvent) => void | No | Receives 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.