React Native

A TypeScript API backed by the native iOS and Android SDKs. The support screen is native on both platforms.

Install#

npm install @parley/react-native
cd ios && pod install

Requires React Native 0.74+ with autolinking. The package's podspec depends on the Parley iOS pod; on Android it depends on app.parleyai:parley-android.

Use#

import { Parley } from "@parley/react-native";

Parley.configure({ appKey: "pk_live_…" });

export function SupportButton() {
  const unread = Parley.useUnreadCount();
  return <Button title={unread ? `Support (${unread})` : "Support"} onPress={() => Parley.presentSupport()} />;
}

// After sign-in
await Parley.identify({ userId: user.id, email: user.email, userHash });

// On sign-out
await Parley.logout();
NameTypeDescription
configure({ appKey, apiUrl?, appearance? })voidCall once, before anything else.
identify({ userId, userHash?, email?, name?, avatarUrl?, attributes? })Promise<void>
updateCustomer({ email?, name?, attributes? })Promise<void>
track(name, properties?)Promise<void>
logout()Promise<void>
presentSupport()voidPresents the native support screen.
registerPushToken(token)Promise<void>APNs (hex) on iOS, FCM token on Android.
useUnreadCount()hookRe-renders on unread changes.
addUnreadCountListener(cb){ remove() }Non-hook subscription.
offers()Promise<Offer[]>Active offers for this customer.
requestReviewIfEligible()Promise<boolean>Calls the platform review API if eligible.
Using Expo? Follow the Expo guide — you'll need a development build.