1.3.0 • Published 8 months ago
@trycourier/courier-js v1.3.0
Overview
SDK used by client applications to interface with the Courier API.
Supported Interfaces
Installation
# npm
npm install @trycourier/courier-js
# yarn
yarn add @trycourier/courier-js
# pnpm
pnpm add @trycourier/courier-js
Usage
Initializing Client
import courier from "@trycourier/courier-js";
courier.init({
clientKey: "<REPLACE_WITH_YOUR_CLIENT_KEY>",
debug: true, // debug enables client side logs for error catching
});
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>", {
// optional
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: