Installation
To implement Inbox in React, you’ll need a backend to retrieve messages. This functionality is managed through theCourierInbox component and requires an active Courier account.
Steps to Set Up Inbox:
1
Install the Courier React SDK
Install the Courier React v8 SDK package for your React version.
2
Create a JWT
After installation, you’ll need a JWT to authenticate your users. A JWT should be generated on a per-user basis in your backend and be supplied to your frontend. The required scopes are the following:An example payload to the issue-token API looks like :
read:messages- Courier can fetch the messageswrite:events- Courier can create events like read/unread/archive
You can designate how long tokens last by passing an
expires_in property to the token generation.3
Configure the CourierInbox
Use JWTs to initialize and configure the CourierInbox component in your application. Here’s a complete example with JWT authentication:
Send a Notification to Inbox
The fastest way to test your inbox is to send a request to the Courier API.
Inbox First Message