Guide

Chatting Expo and React Native guide: add visitor chat with a real mobile package

Step-by-step Expo and React Native installation guide with the exact npm command, imports, push setup, and support screen code.

Chatting Expo and React Native guide cover with a mobile chat mockup and app setup panels.
9 Apr 20265 min read

Before you start

  • An Expo or React Native app that can install npm packages
  • Use https://usechatting.com as baseURL
  • Use your site/workspace ID inside Chatting as siteId
  • Async storage for session persistence
  • A physical device if you want to test Expo push notifications

That is the full default setup: baseURL is always https://usechatting.com, and siteId is your site/workspace ID inside Chatting.

Install the package

  1. Install @usechatting/react-native in your app
  2. Install async storage so conversations stay available after app restarts
  3. Install Expo Notifications if you want push delivery
bash
npm install @usechatting/react-native @react-native-async-storage/async-storage
npx expo install expo-notifications

If you are using plain React Native instead of Expo, you can still use the same chat package. The Expo Notifications step is only for Expo push notifications.

Create the client

Create one ChattingClient with your Chatting URL, site ID, and session store.

tsx
import AsyncStorage from "@react-native-async-storage/async-storage";
import { ChattingClient, createKeyValueSessionStore } from "@usechatting/react-native";

const client = new ChattingClient({
  baseURL: "https://usechatting.com",
  siteId: "your-site-id",
  sessionStore: createKeyValueSessionStore(AsyncStorage, "your-site-id")
});

Add the support screen

Mount ChattingConversationScreen in your support screen or support tab.

tsx
import { useMemo } from "react";
import { ChattingConversationScreen } from "@usechatting/react-native";

export function SupportScreen() {
  const context = useMemo(() => ({ pageUrl: "myapp://support" }), []);

  return (
    <ChattingConversationScreen
      client={client}
      context={context}
      draftVisitorEmail="customer@example.com"
    />
  );
}

This gives you an in-app support screen with saved conversations and live message updates while the app is open.

Register Expo push notifications

Register an Expo push token if your app should notify users after the app is backgrounded. Refresh the chat when the app becomes active again.

tsx
import { useEffect, useState } from "react";
import * as Notifications from "expo-notifications";
import { AppState, Platform } from "react-native";
import type { ChattingClient } from "@usechatting/react-native";

Notifications.setNotificationHandler({
  handleNotification: async () => ({
    shouldShowAlert: false,
    shouldPlaySound: false,
    shouldSetBadge: false
  })
});

export function useChattingPush(client: ChattingClient) {
  const [refreshKey, setRefreshKey] = useState(0);

  useEffect(() => {
    let mounted = true;

    const refreshChat = async () => {
      await client.syncPushToken();
      if (mounted) {
        setRefreshKey((current) => current + 1);
      }
    };

    const registerPush = async () => {
      const permission = await Notifications.requestPermissionsAsync();
      if (!mounted || permission.status !== "granted") {
        return;
      }

      const token = await Notifications.getExpoPushTokenAsync({
        projectId: "your-expo-project-id"
      });

      await client.registerPushToken({
        pushToken: token.data,
        platform: Platform.OS
      });
    };

    void registerPush();

    const appStateSubscription = AppState.addEventListener("change", (nextState) => {
      if (nextState === "active") {
        void refreshChat();
      }
    });

    const responseSubscription = Notifications.addNotificationResponseReceivedListener(() => {
      void refreshChat();
    });

    return () => {
      mounted = false;
      appStateSubscription.remove();
      responseSubscription.remove();
    };
  }, [client]);

  return refreshKey;
}

// Then pass the returned key into your chat screen:
const refreshKey = useChattingPush(client);
<ChattingConversationScreen key={refreshKey} client={client} />

Expo documents that push notifications need a physical device for testing, and expo-notifications must be installed before you request a token.

Identify signed-in users

If your app already knows the customer, identify them before or right after the support screen mounts. If not, you can pass a draft email only.

tsx
await client.identify({
  email: "customer@example.com",
  name: "Taylor"
});

<ChattingConversationScreen
  client={client}
  draftVisitorEmail="customer@example.com"
/>

Use identify(...) for signed-in users. Use draftVisitorEmail if you only need an email address for follow-up.

Check the installation

  1. Open the support screen in your app
  2. Send a test message from the device
  3. Reply from the Chatting inbox and confirm the reply appears in the app
  4. Background the app and send another reply from the inbox
  5. Tap the push notification and confirm the conversation refreshes

FAQ

Does this work in Expo?

Yes. The published package works in Expo and the setup above uses the package exactly as published.

Does this work in React Native too?

Yes. The core package works in React Native as well. Expo Notifications is only needed if you want the Expo push flow.

What should I use for baseURL?

Use https://usechatting.com.

Ready to add Chatting to Expo?

Install the package, add your site ID, and launch one support screen in your app first.

Open Chatting

Live chat for small teams.
No enterprise bloat.

Start free — live in 3 minutes →

No credit card. No sales call.