0.1.2 • Published 14 days ago

@dopt/users-javascript-client v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

Dopt users JavaScript client

Overview

The Dopt users JavaScript client is a friendly client-side package for accessing the Dopt blocks API to access and updates block and flow state for a particular user in Dopt.

It is published to npm as @dopt/users-javascript-client.

Installation

Via npm:

npm install @dopt/users-javascript-client

Via Yarn:

yarn add @dopt/users-javascript-client

Via pnpm:

pnpm add @dopt/users-javascript-client

Configuration

To configure the Users JavaScript Client you will need

  1. A users API key (generated in Dopt)
  2. An identifier for the user or group you wish to identify (the same identifier will be used in the React SDK)
  3. The properties you wish to store and/or update for the given user or group

Usage

Initialization

import { DoptApiClient } from '@dopt/users-javascript-client';

const client = new DoptApiClient({
  apiKey: process.env.DOPT_USERS_API_KEY as string,
});

Users

Identify a single user to Dopt.

await client.users.identifyUser({
  identifier: 'identifier_example',
  properties: {
    stringExample: 'string',
    numberExample: 12345,
    booleanExample: true,
    nullExample: null,
  },
});

Identify a batch of users to Dopt.

await client.users.identifyUsers([
  {
    identifier: 'identifier_example',
    properties: {
      stringExample: 'string',
      numberExample: 12345,
      booleanExample: true,
      nullExample: null,
    },
  },
  {
    identifier: 'user2_identifier',
    properties: {
      stringExample: 'string',
    },
  },
]);

Groups

Identify a group to Dopt.

await client.groups.identifyGroup({
  identifier: 'group_identifier_example',
  properties: {
    stringExample: 'string',
    numberExample: 12345,
    booleanExample: true,
    nullExample: null,
  },
});
0.1.2

14 days ago

0.1.1

20 days ago

0.1.0

21 days ago

1.0.1

11 months ago

1.0.0

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.5

1 year ago

0.0.6

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago