Skip to content
embed-sdk-node / 1.0.0

embed-sdk-node 1.0.0

Install from the command line:
Learn more about npm packages
$ npm install @upvio/embed-sdk-node@1.0.0
Install via package.json:
"@upvio/embed-sdk-node": "1.0.0"

About this version

Cogsworth Embed App Backend SDK

The Cogsworth Embed App SDK allows Cogsworth partners to embed the Cogsworth Embed application in their own sites with minimal configuration.

Installation

npm install @cogsworth4/embed-sdk-node
# or
yarn add @cogsworth4/embed-sdk-node

Usage

In order to securely generate a signed payload, it is required that you set up an endpoint in your backend. Your client application can then consume this endpoint to render the embed application.

The package needs to be configured with your Cogsworth account ID and API key, which you can find in your Cogsworh Dashboard:

import CogsworthSDK from "@cogsworth4/embed-sdk-node";

const cogsworth = new CogsworthSDK({
  partnerId: "xxxxx",
  apiKey: "xxxxxx",
});

You can then use the SDK to generate a secure payload:

const payload = cogsworth.generateClientPayload({
  user: {
    id: "xxxxxxxx",
    email: "[email protected]",
    name: "Dr. Test User",
  },
  business: {
    id: "xxxxxxxx",
    name: "Example Business",
    timezone: "Sydney/Australia",
    userRole: "OWNER",
    location: "https://partner.com/room/xxxxxxxx",
  },
});

Payload data

The payload needs to contain a user and a business objects, which require the following details:

User

  • user.id - A unique identifier for the user in your system
  • user.email - Emails are unique for each user
  • user.name - The user name

Business

  • business.id - A unique identifier for the user in your system
  • business.name - The business name
  • business.timezone - See a List of possible timezones.
  • business.userRole - The role for the provided user in this business. Can be one of the following:
    • "OWNER": The business owner. Has full access to the business. Cogsworth can provision new businesses for owners only.
    • "ADMIN": The business owner. Has full access to the business.
    • "STAFF": Has limited access. Cannot change business settings and can only see their own appointments.
  • business.location -Optional- The default location for the business appointments. If the value starts with https, it will be detected as a URL.

Full example

const handler = (req, res) => {
  const cogsworth = new CogsworthSDK({
    partnerId: "xxxxxxxx",
    apiKey: "xxxxxxxx",
  });

  const clientPayload = cogsworth.generateClientPayload({
    user: {
      id: "xxxxxxxx",
      email: "[email protected]",
      name: "Dr. Test User",
    },
    business: {
      id: "xxxxxxxx",
      name: "Example Business",
      timezone: "Sydney/Australia",
      userRole: "OWNER",
      location: "https://www.partner.com/room/xxxxxxxx",
  });

  res.send(clientPayload);
};

Details


Assets

  • embed-sdk-node-1.0.0-npm.tgz

Download activity

  • Total downloads 8
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all