@quantum-sa/cdp
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@quantum-sa/cdp

What is a CDP?

CDP stands for Customer Data Platform. It's like a central hub where businesses store all the information they have about their customers. This includes things like their purchases, interactions, and preferences. The cool thing about CDPs is that they organize this data so businesses can use it to improve their marketing, customer service, and overall experience for customers. Think of it as a smart filing system for customer information

How to get it?
  • Share your use-case with us here
  • We will understand your requirements and suggest you the best course of action
  • We will share required environment variables which you can replace and after installing the SDK and start improving your conversions from day one!

Installation

npm install @quantum-sa/cdp

How-To

After you have installed the sdk, you will need to activate it by supplying some environment variables to be able to interact with it. Our support team will be responsible for sharing this information with you + onboarding you to get the most benefit out of it.

Initial setup: [index.js]

import {SDK} from '@quantum-sa/cdp';
OR const {SDK} = require("@quantum-sa/cdp");

const client = new SDK({
    base_url: <BASE_URL>,
    site_id: <SITE_ID>,
    api_key: <API_KEY>
});

After this initial configuration, you will be able to interact with different modules inside this SDK as shown below:

Create Customer

  try {
    const customer = await client.customers.createCustomer
    ({
        ...customer_fields
    });
  } catch (error) {
    console.log(error.message);
  }
Customer Fields Type Required
local_id string true
email string true
name string true
interest string false
age string false
phone string false
company_name string false
job_position string false
profile_photo string false
custom_key string false

Update Customer

  try {
    const customer = await client.customers.updateCustomer
    ({
        ...customer_fields
    });
    console.log(customer)
  } catch (error) {
    console.log(error.message);
  }

updating a customer will replace the existing record, so make sure to send existing+updated payload alongside all the required fields.

Create Event

After you are done with creating a customer, you can use their email to register events to create a journey of that user on your platform. Details are mentioned below:

  try {
    const event = await client.events.createEvent
    ({
        ...event_fields
    });
    console.log(event)
  } catch (error) {
    console.log(error.message);
  }`
Event Fields Type Required
email string true
name string true
type string true ['event','page']
data object false

you can only pass event|page as event type, and add additional data by passing it into the data object.

Create Device

After you are done with creating a customer, you can use their email to associate devices. E.g. if you are running a mobile application, whenever changes their device upon login, you can send that information to this endpoint which will keep track of all device changes against a customer's email. This can become a unique data point to be used in marketing campaigns later on.

  try {
    const device = await client.devices.createDevice
    ({
        ...device_fields
    });
    console.log(device)
  } catch (error) {
    console.log(error.message);
  }`
Device Fields Type Required Comments
email string true -
device_token string true Unique token of the device
platform string true e.g. Android/IPhone
attributes object false See below

You can use the following keys for device attributes:

Attr. Fields Type Required Comments
device_os string false e.g Android:13.0.1
device_model string false e.g. TFY-LX2
app_version string false e.g. current version of your app
pio_sdk_version string false e.g. current version of this sdk
push_enabled boolean false This is the user's preference of receiving PNs
push_token string false We use FCM for push notification campaigns, so this should be a valid token received from FCM if it is configured

License

MIT

Package Sidebar

Install

npm i @quantum-sa/cdp

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

24.6 kB

Total Files

17

Last publish

Collaborators

  • quantum-sa