@commonninja/node-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.37 • Public • Published

@commonninja/node-sdk

Release

Installation

// NPM
npm i @commonninja/node-sdk

// Yarn
yarn add @commonninja/node-sdk

Usage

import { CommonNinja } from '@commonninja/node-sdk';

const client = new CommonNinja({
  appId: process.env.COMMONNINJA_APP_ID,
  appSecret: process.env.COMMONNINJA_APP_SECRET,
  accessToken: req.query.token,
  env: CommonNinja.envs.production,
});

// Get shop products, filter by category
const { data, success, message } = await client.ecommerce.getProducts({
  category: '1',
});

// Get shop orders
const { data, success, message } = await client.ecommerce.getOrders();

// Get shop customers with pagination parameters
const { data, success, message } = await client.ecommerce.getCustomers({
  limit: 5,
  page: 1,
});

// Get user details
const { data, success, message } = await client.user.getDetails();

// Get connect to platform screen url
const connectUrl = client.auth.getConnectUrl();

// Get Shopify authentication url
const redirectUrl = client.auth.getAuthenticationUrl('shopify');

// Validate an incoming webhook message from Common Ninja
client.webhooks.validateWebhook(req);

Learn more about the different APIs in our official docs.

Readme

Keywords

Package Sidebar

Install

npm i @commonninja/node-sdk

Weekly Downloads

118

Version

1.1.37

License

ISC

Unpacked Size

47.3 kB

Total Files

26

Last publish

Collaborators

  • v-nohana
  • dsternlicht