The React Native Chat SDK can be installed in a few lines of code in any React Native or Expo app.
The Crisp Chat SDK allows you to add a chat widget to your React Native mobile app, enabling your customers to engage with your brand and easily communicate with your team. Just discovering Crisp and our SDK? You can learn more about our Chat SDKs right here.
Notice
Features
- iOS & Android support
- TypeScript support
- Full Expo support
- Push notifications support
- Event listeners
- Helpdesk integration
- Bot scenarios
Installation
For Expo Apps
Install the SDK using your preferred package manager:
npx expo install crisp-sdk-react-native
Version Targeting
The Crisp SDK requires minimum OS versions to function properly. Install expo-build-properties and configure your app.json:
npx expo install expo-build-properties
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"ios": {
"deploymentTarget": "15.1"
},
"android": {
"minSdkVersion": 21
}
}
]
]
}
}
For Bare React Native Apps
Prerequisites
Before starting, ensure you have:
- React Native 0.79+
- iOS deployment target 15.1+
- Android minSdkVersion 21+
- Node.js 18+
Step 1: Install Expo Modules
Run the following command in your project root:
npx install-expo-modules@latest
This command automatically configures your iOS and Android projects to support Expo modules.
Step 2: Install Crisp SDK
npm install crisp-sdk-react-native
Step 3: Platform Configuration
iOS:
cd ios && pod install
Android:
Ensure your android/app/build.gradle has:
android {
compileSdkVersion 34
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
}
}
How To Get Your Website ID?
Go to your Crisp Dashboard, and copy your Website ID:

Error starting chat errors. This setting can be found in Settings > Website Settings > Chatbox & Email Settings > Chatbox Security.Usage
Configure the SDK at app startup with your Website ID:
import { useEffect } from "react";
import { configure, show } from "crisp-sdk-react-native";
export default function App() {
useEffect(() => {
configure("YOUR_WEBSITE_ID");
}, []);
return (
// Your app content
);
}
Open Chat
Display the Crisp chat widget:
import { show } from "crisp-sdk-react-native";
function ChatButton() {
const openChat = () => {
show();
};
return <Button title="Open Chat" onPress={openChat} />;
}
User Identification
Set user information to personalize the chat experience:
import {
setUserEmail, setUserNickname, setUserPhone, setUserAvatar,
setUserCompany, setTokenId, resetSession,
} from "crisp-sdk-react-native";
// After user logs in
function identifyUser(user) {
// Basic identification
setUserEmail(user.email);
setUserNickname(user.name);
setUserPhone(user.phone); // E.164 format recommended: "+1234567890"
setUserAvatar(user.avatarUrl);
// Set company information
setUserCompany({
name: "Acme Corporation",
url: "https://acme.com",
companyDescription: "Leading provider of innovative solutions",
employment: {
title: "Software Engineer",
role: "Engineering",
},
geolocation: {
country: "France",
city: "Paris",
},
});
// Enable session persistence across devices
setTokenId(user.id);
}
// On logout
function onLogout() {
setTokenId(null);
resetSession();
}
Session Data
Store custom data visible to operators in the Crisp dashboard:
import {
setSessionString, setSessionBool, setSessionInt,
setSessionSegment, setSessionSegments, getSessionIdentifier,
} from "crisp-sdk-react-native";
// Store different data types
setSessionString("plan", "premium");
setSessionBool("verified", true);
setSessionInt("loginCount", 42);
// Categorize users with segments
setSessionSegment("vip");
// Or set multiple segments at once
setSessionSegments(["premium", "early-adopter", "beta-tester"]);
// Get the current session identifier
const sessionId = await getSessionIdentifier();
Event Tracking
Track user actions in the chat timeline:
import { pushSessionEvent, CrispSessionEventColors } from "crisp-sdk-react-native";
// Track events
pushSessionEvent("Purchase completed", CrispSessionEventColors.GREEN);
pushSessionEvent("Payment failed", CrispSessionEventColors.RED);
Event Listeners
Subscribe to SDK events using the useCrispEvents hook:
import { useState } from "react";
import { show, useCrispEvents } from "crisp-sdk-react-native";
function ChatScreen() {
const [unreadCount, setUnreadCount] = useState(0);
useCrispEvents({
onSessionLoaded: (sessionId) => {
console.log("Crisp session ready:", sessionId);
},
onChatOpened: () => {
console.log("Chat opened");
setUnreadCount(0);
},
onChatClosed: () => {
console.log("Chat closed");
},
onMessageSent: (message) => {
console.log("User sent:", message.content);
},
onMessageReceived: (message) => {
console.log("Received:", message.content);
if (message.fromOperator) {
setUnreadCount((count) => count + 1);
}
},
});
return <Button title={`Chat (${unreadCount})`} onPress={() => show()} />;
}
Helpdesk
Access your knowledge base:
import { searchHelpdesk, openHelpdeskArticle } from "crisp-sdk-react-native";
// Open helpdesk search
searchHelpdesk();
// Open a specific article
openHelpdeskArticle({
id: "getting-started",
locale: "en",
title: "Getting Started",
category: "Onboarding",
});
Bot Scenarios
Trigger automated conversation flows:
import { runBotScenario } from "crisp-sdk-react-native";
// Start a bot scenario configured in your Crisp dashboard
runBotScenario("welcome-flow");
Push Notifications
To enable push notifications, add the config plugin to your app.json or app.config.js:
{
"expo": {
"plugins": [
[
"crisp-sdk-react-native",
{
"websiteId": "YOUR_WEBSITE_ID",
"notifications": {
"enabled": true,
"mode": "sdk-managed"
}
}
]
]
}
}
Push notifications require additional setup in your Crisp Dashboard (APNs for iOS, Firebase for Android). See the Push Notifications Setup Guide for detailed step-by-step instructions.
npx expo prebuild --clean followed by npx expo run:ios or npx expo run:android.Available APIs
Configuration Methods
| Method | Description |
|---|---|
configure(websiteId) |
Initialize the SDK with your Website ID. Must be called once at app startup. |
setTokenId(tokenId) |
Set a token for session persistence across app reinstalls and devices. |
User Information Methods
| Method | Description |
|---|---|
setUserEmail(email, signature?) |
Set the user's email address. Optional HMAC signature for identity verification. |
setUserNickname(name) |
Set the user's display name in the chat. |
setUserPhone(phone) |
Set the user's phone number. E.164 format recommended. |
setUserAvatar(url) |
Set the user's avatar image URL. |
setUserCompany(company) |
Set the user's company information. |
Session Data Methods
| Method | Description |
|---|---|
setSessionString(key, value) |
Store a custom string value in session data. |
setSessionBool(key, value) |
Store a custom boolean value in session data. |
setSessionInt(key, value) |
Store a custom integer value in session data. |
setSessionSegment(segment) |
Set a single segment to categorize the user. |
setSessionSegments(segments, overwrite?) |
Set multiple segments. If overwrite is true, replaces existing segments. |
getSessionIdentifier() |
Get the current session identifier. Returns Promise<string | null>. |
Event Tracking Methods
| Method | Description |
|---|---|
pushSessionEvent(name, color) |
Track a single event in the user's chat timeline. |
pushSessionEvents(events) |
Track multiple events at once. |
Session Management
| Method | Description |
|---|---|
resetSession() |
Clear the current session and start a fresh conversation. |
UI Methods
| Method | Description |
|---|---|
show() |
Open the Crisp chat widget. |
searchHelpdesk() |
Open the helpdesk search interface. |
openHelpdeskArticle(options) |
Open a specific helpdesk article. |
runBotScenario(scenarioId) |
Trigger an automated bot scenario. |
showMessage(content) |
Display a message in the local chatbox. |
React Hook
| Hook | Description |
|---|---|
useCrispEvents(callbacks) |
Subscribe to SDK events with automatic cleanup. |
Example Apps
Two fully functional example apps are included in the repository:
| App | Description |
|---|---|
| Expo Example | Expo Router app with push notifications, event listeners, and all SDK features |
| Bare React Native Example | Bare React Native CLI app demonstrating integration without the Expo managed workflow |
Troubleshooting
"Expo Go is not supported"
The Crisp SDK requires native modules. Use a development build instead:
npx expo run:ios
# or
npx expo run:android
Chat not appearing after show()
Ensure you've called configure() with a valid Website ID before calling show().
Push notifications not working
- Verify the config plugin is properly configured in
app.json - Rebuild with
npx expo prebuild --clean - Ensure your Crisp dashboard has push notifications enabled
- For iOS: Verify APNs certificates are configured in Crisp dashboard
- For Android: Verify Firebase is properly configured
Session data not persisting
Use setTokenId() with a unique user identifier to enable session persistence across app reinstalls and devices.