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)
Installation
- Via NPM:
npm install @knocklabs/react-native
- Via Yarn:
yarn add @knocklabs/react-native
💡
Using Expo? Install
@knocklabs/expo
instead to use our Expo SDK.Configuration
To configure the feed you will need:
-
A public API key (found in the Knock dashboard)
-
A user ID and an auth token
💡Auth tokens are strongly recommended for production environments and are required when enhanced security mode is enabled. For more information, see our Security & Authentication documentation. -
If integrating an in-app feed, a feed 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: