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
The Cogsworth Embed App SDK allows Cogsworth partners to embed the Cogsworth Embed application in their own sites with minimal configuration.
npm install @cogsworth4/embed-sdk-node
# or
yarn add @cogsworth4/embed-sdk-node
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",
},
});
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.
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
- embed-sdk-node
- upvio
- over 2 years ago
- MIT
- 8 dependencies
Assets
- embed-sdk-node-1.0.0-npm.tgz
Download activity
- Total downloads 8
- Last 30 days 0
- Last week 0
- Today 0