npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sitecore-cdp-personalize-api

v1.0.1

Published

The sitecore-cdp-personalize-api library is used to quickly integrate with Boxever (Sitecore CDP and Personalize) HTTP APIs.

Downloads

3

Readme

Sitecore CDP and Personalize API

The sitecore-cdp-personalize-api library is used to quickly integrate with Boxever (Sitecore CDP and Personalize) HTTP APIs.

Features

  • Typescript Support
  • Easy to use wrapper over Boxever (Sitecore CDP and Personalize) HTTP APIs
  • Promise-based

Usage

Installaion

npm install sitecore-cdp-personalize-api

Core Setup

import { cdpPersonalizeApi } from 'sitecore-cdp-personalize-api';

//Configure CDP and Personalize API
cdpPersonalizeApi.initialize({
  clientKey: '[CLIENT_KEY]',
  apiToken: '[API_TOKEN]',
  pointOfSale: '[POINT_OF_SALE]',
  apiEndpoint: 'https://api.boxever.com/v2',
  currency: '[CURRENCY]',
  language: '[LANGAUGE]',
  channel: '[CHANNEL]',
});

Methods

Sitecore CDP and Personalize has many APIs across entities. To keep things simple, everything is broken down by entity type.

Guest

cdpPersonalizeApi
  .guest()
  .locate({
    email: '[EMAIL]',
    // other query parameters
  })
  .then(result => {
    console.log(result);
  });

cdpPersonalizeApi
  .guest()
  .retrieve('[GUEST_REF]')
  .then(result => {
    console.log(result);
  });

cdpPersonalizeApi
  .guest()
  .create({
    //guest data
  })
  .then(result => {
    console.log(result);
  });

cdpPersonalizeApi
  .guest()
  .update('[GUEST_REF]', {
    //guest data
  })
  .then(result => {
    console.log(result);
  });

Guest Data Extenions

cdpPersonalizeApi
  .dataExtension()
  .locate('[GUEST_REF]', '[EXTENSION_NAME]')
  .then(result => console.log(result));

cdpPersonalizeApi
  .dataExtension()
  .retrieve('[GUEST_REF]', '[EXTENSION_NAME]', '[EXTENSION_ID]')
  .then(result => console.log(result));

cdpPersonalizeApi
  .dataExtension()
  .upsert('[GUEST_REF]', '[EXTENSION_NAME]', {
    //data extension data
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .dataExtension()
  .delete('[GUEST_REF]', '[EXTENSION_NAME]', '[EXTENSION_ID]')
  .then(result => console.log(result));

CallFlows

type customResponse = {
  myProperty: string;
  otherData: number;
};

cdpPersonalizeApi
  .callFlows()
  .execute<customResponse>('[FRIENDLY_ID]', {
    //other body properties you need
  })
  .then(result => {
    console.log(result, result.myProperty, result.otherData);
  });

Orders

cdpPersonalizeApi
  .order()
  .locate('[GUEST_REF]', {
    //additioanl query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .order()
  .retrieve('[ORDER_REF]')
  .then(result => console.log(result));

cdpPersonalizeApi
  .order()
  .create('[GUEST_REF]', {
    //order data
  })
  .then(result => console.log(result));

Order Items

cdpPersonalizeApi
  .orderItem()
  .locate('[ORDER_REF]', {
    //additional query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderItem()
  .retrieve('[ORDER_ITEM_REF]', {
    //additional query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderItem()
  .create('[ORDER_REF]', {
    //order item data
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderItem()
  .update('[ORDER_ITEM_REF]', {
    //order item data
  })
  .then(result => console.log(result));

Order Consumer

cdpPersonalizeApi
  .orderConsumer()
  .locate('[ORDER_REF]', {
    //additional query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderConsumer()
  .retrieve('[ORDER_CONSUMER_REF]', {
    //additional query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderConsumer()
  .create('[ORDER_REF]', {
    //order consumer data
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderConsumer()
  .update('[ORDER_CONSUMER_REF]', {
    //order consumer data
  })
  .then(result => console.log(result));

Order Contact

cdpPersonalizeApi
  .orderContact()
  .locate('[ORDER_REF]', {
    //additional query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderContact()
  .retrieve('[ORDER_CONTACT_REF]', {
    //additional query params
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderContact()
  .create('[ORDER_REF]', {
    //order contact data
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderContact()
  .update('[ORDER_CONTACT_REF]', {
    //order contact data
  })
  .then(result => console.log(result));

cdpPersonalizeApi
  .orderContact()
  .delete('[ORDER_CONTACT_REF]')
  .then(result => console.log(result));

More to come!

This package is still under development, but more APIs are coming soon.