Getting started with the Knock React Native SDK
Get started with the Knock React Native SDK to build in-app notification experiences.
To get started, you will need the following:
- A Knock Account
- A public API key for the Knock environment (which you'll use in the
publishableKey
) - An in-app feed channel with a workflow that produces in-app feed messages (optional)
- An APNS channel with a workflow that produces push notifications (optional)
Installation
- Via NPM:
npm install @knocklabs/react-native
- Via Yarn:
yarn add @knocklabs/react-native
Configuration
To configure the feed you will need:
- A public API key (found in the Knock dashboard)
- A user ID, and optionally an auth token for production environments
- If integrating an in-app feed, a feed channel ID (found in the Knock dashboard)
- If integrating push notifications, an Expo channel ID (found in the Knock dashboard)
Usage
You can integrate the feed into your app as follows:
Headless usage
Alternatively, if you don't want to use our components you can render the feed in a headless mode using our hooks: