Overview
SDK used by client applications to interface with the Courier API.
Supported Interfaces
Feature | Description |
---|
Identify
|
Event that triggers a user Create or Update within Courier Profiles.
|
Track
|
Event ingested by Courier can be used to trigger an automation or supply inline payloads within an existing automation workflow.
|
GeneratePreferencesUrl
|
Generates URL that can be used to link users to Preferences Center to manage their notification preferences.
|
Installation
npm install @trycourier/courier-js
yarn add @trycourier/courier-js
pnpm add @trycourier/courier-js
Usage
Initializing Client
import courier from "@trycourier/courier-js";
courier.init({
clientKey: "<REPLACE_WITH_YOUR_CLIENT_KEY>",
debug: true,
});
Identify
await courierSDK.identify("purbleUserId", {
email: "customer@purbleplace.com",
favoriteColor: "purple",
});
Track
Basic
await courierSDK.track("user-signup");
With data payload
await courierSDK.track("bake-cake", {
cakeFlavor: "carrot",
frosting: "cream cheese"
});
GeneratePreferencesUrl
const prefCenterLink = courier.generatePreferencesUrl("<user-id>", {
brandId: "<brand-id>",
});
Share feedback with Courier
We are building the best SDKs for handling notifications! Have an idea or feedback about our SDKs? Here are some links to contact us: