1.0.4 • Published 2 months ago

@quantum-sa/cdp v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

@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 FieldsTypeRequired
local_idstringtrue
emailstringtrue
namestringtrue
intereststringfalse
agestringfalse
phonestringfalse
company_namestringfalse
job_positionstringfalse
profile_photostringfalse
custom_keystringfalse

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 FieldsTypeRequired
emailstringtrue
namestringtrue
typestringtrue 'event','page'
dataobjectfalse

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 FieldsTypeRequiredComments
emailstringtrue-
device_tokenstringtrueUnique token of the device
platformstringtruee.g. Android/IPhone
attributesobjectfalseSee below

You can use the following keys for device attributes:

Attr. FieldsTypeRequiredComments
device_osstringfalsee.g Android:13.0.1
device_modelstringfalsee.g. TFY-LX2
app_versionstringfalsee.g. current version of your app
pio_sdk_versionstringfalsee.g. current version of this sdk
push_enabledbooleanfalseThis is the user's preference of receiving PNs
push_tokenstringfalseWe use FCM for push notification campaigns, so this should be a valid token received from FCM if it is configured

License

MIT