Skip to content

saschabratton/rejoiner-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rejoiner Node.js client wrapper

Install

yarn add rejoiner

or

npm install rejoiner --save

Use

var Rejoiner = require('rejoiner')

var client = new Rejoiner({
  // Your Site ID
  siteId: 'eXaMpLe',
  // Your API key
  apiKey: 'tHiSaPiKeYiSjUsTaNeXaMpLeAnDyOuCaNtUsEiT',
})

Ping

The ping endpoint can be used to verify your credentials are working.

client.verify.ping()
  .then(...)
  .catch(...)

Customer Endpoints

Convert Customer

client.customer.convert({
  email: '[email protected]',
  cart_data: {
    cart_value: 20000,
    cart_item_count: 2,
    promo: 'COUPON_CODE',
    return_url: 'https://www.example.com/return_url',
    ...
  },
  cart_items: [
    {
      product_id: 'example',
      name: 'Example Product',
      price: 10000,
      description: 'Information about Example Product.',
      category: [
        'Example Category 1',
        'Example Category 2',
      ],
      item_qty: 1,
      qty_price: 10000,
      product_url: 'https://www.example.com/products/example',
      image_url: 'https://www.example.com/products/example/images/example.jpg',
      ...
    },
    {
      product_id: 'example2',
      name: 'Example Product 2',
      price: 10000,
      description: 'Information about Example Product 2.',
      category: [
        'Example Category 2',
        'Example Category 3',
      ],
      item_qty: 1,
      qty_price: 10000,
      product_url: 'https://www.example.com/products/example2',
      image_url: 'https://www.example.com/products/example2/images/example.jpg',
      ...
    },
    ...
  ],
})
  .then(...)
  .catch(...)

Journey Cancellation

client.customer.cancel('[email protected]')
  .then(...)
  .catch(...)

Customer Unsubscribe

client.customer.unsubscribe('[email protected]')
  .then(...)
  .catch(...)

Record Explicit Customer Consent

client.customer.optIn('[email protected]')
  .then(...)
  .catch(...)

Customer Preference Tags

Get Preference Tags

client.customer.preferenceTags.get('[email protected]')
  .then(...)
  .catch(...)

Replace Preference Tags

client.customer.preferenceTags.set('[email protected]', ['example-tag'])
  .then(...)
  .catch(...)

Add Preference Tags

client.customer.preferenceTags.add('[email protected]', ['example-tag'])
  .then(...)
  .catch(...)

Remove Preference Tags

client.customer.preferenceTags.remove('[email protected]', ['example-tag'])
  .then(...)
  .catch(...)

Email List Endpoints

Email Lists

client.lists.get()
  .then(...)
  .catch(...)

Retrieving Listing of Contacts

client.lists.contacts('eXaMpLeLiStId').get()
  .then(...)
  .catch(...)

With optional page number for pagination

client.lists.contacts('eXaMpLeLiStId').get(2)
  .then(...)
  .catch(...)

Add Customer to List

client.lists.contacts('eXaMpLeLiStId').add('[email protected]')
  .then(...)
  .catch(...)

Remove Customer From List

client.lists.contacts('eXaMpLeLiStId').remove('[email protected]')
  .then(...)
  .catch(...)

About

Rejoiner REST API client wrapper for Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published