@trycourier/courier-js
TypeScript icon, indicating that this package has built-in type declarations

1.4.2 • Public • Published

Courier: Your Complete Communication Stack

Overview

SDK used by client applications to interface with the Courier API.  

Requirements
Courier Account Sign Up
Client API Key Get key

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
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:

Readme

Keywords

none

Package Sidebar

Install

npm i @trycourier/courier-js

Weekly Downloads

1,304

Version

1.4.2

License

MIT

Unpacked Size

22.3 kB

Total Files

6

Last publish

Collaborators

  • mikemilla
  • troygoode
  • scarney