Courier React Native SDK
The Courier React Native SDK provides prebuilt components and TypeScript APIs for adding in-app notifications, push notifications, and notification preferences to your React Native app. It handles authentication, token management, and real-time message delivery across iOS and Android from a single codebase.
Installation
npm install @trycourier/courier-react-native
Also available via yarn add @trycourier/courier-react-native.
Requires iOS 15.0+, Android SDK 23+, and Gradle 8.4+. Run cd ios && pod install after installing.
Quick Start
import Courier, {
CourierInboxView,
CourierPreferencesView,
} from "@trycourier/courier-react-native";
await Courier.shared.signIn({
userId: "user_123",
accessToken: jwt,
});
<CourierInboxView
onClickInboxMessageAtIndex={(message, index) => {
message.read
? Courier.shared.unreadMessage({ messageId: message.messageId })
: Courier.shared.readMessage({ messageId: message.messageId });
}}
style={{ flex: 1 }}
/>
<CourierPreferencesView
mode={{ type: "topic" }}
style={{ flex: 1 }}
/>
For Expo projects, see the Expo setup guide.
Documentation
Full documentation: courier.com/docs/sdk-libraries/react-native
Getting Started
These are all the available features of the SDK.
|
1
|
Authentication
|
Manages user credentials between app sessions. Required if you would like to use Courier Inbox and Push Notifications.
|
|
2
|
Inbox
|
An in-app notification center you can use to notify your users. Comes with a prebuilt UI and also supports fully custom UIs.
|
|
3
|
Push Notifications
|
Automatically manages push notification device tokens and gives convenient functions for handling push notification receiving and clicking.
|
|
4
|
Preferences
|
Allow users to update which types of notifications they would like to receive.
|
|
5
|
CourierClient
|
The base level API wrapper around the Courier endpoints. Useful if you have a highly customized user experience or codebase requirements.
|
Expo
If you are using Expo, you should check out the Expo Docs for all the details.
Example Projects
Starter projects using this SDK.
Share feedback with Courier
We want to make this the best SDK for managing notifications! Have an idea or feedback about our SDKs? Let us know!
Courier React Native Issues
EU endpoints
If your workspace uses EU-hosted Courier endpoints, pass the built-in EU preset through apiUrls.
import Courier, { getCourierApiUrlsForRegion } from "@trycourier/courier-react-native";
await Courier.shared.signIn({
userId: "your_user_id",
accessToken: jwt,
apiUrls: getCourierApiUrlsForRegion("eu")
});