@trycourier/courier-js
v1.4.2
Published
[![Courier: Your Complete Communication Stack](https://www.courier.com/_next/image/?url=https%3A%2F%2Fimages.ctfassets.net%2Fz7iqk1q8njt4%2F1PZo9WNTdmoDoYH3yulXa0%2Fb10830f7bfb09af5e644a39ac3d20c41%2FCourierJS_header_alt2.png&w=1920&q=75)](https://courier
Downloads
13,615
Readme
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: "[email protected]",
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: