@servisbot/sb-sdk
v15.8.0
Published
An SDK to interact with ServisBOT
Downloads
1,619
Readme
sb-sdk
An SDK for all your ServisBOT Needs
Goal
- Lightweight SDK to interact with ServisBOTs AWS4 signed APIs across many clients including ** portal ** servisbot cli
Install
npm install --save @servisbot/sb-sdk
BREAKING CHANGES
From version 6.6.0 onwards - SB.Auth now requires two new parameters for working with lithium resources - lithiumHttpApiUrl and cognitoJwtToken 8.0.0 - Changes to AuthProfile contracts to move towards consistency with lithium
12.0.0 - Changes to a number of the metric requests - start and end are no longer epoch timestamps
- queryUserInput
- queryDAUMetrics
- queryAPIMetrics
- querySessionEventMetrics
- QueryRestrictionGroupMetrics
15.0.0 - Drawbridge Removed
- Remove Security Class
- Remove create,join,leave,message functions from conversation
Getting Started
Auth
The Auth class requires Organization, Bullseye Url, Virtual Assistant URL, lithiumHttpApiUrl and Credentials for aws4 signed requests.
- A function that returns the credentials
- An object containing the credentials
To work with Lithium a cognito cognitoJwtToken is required, this is the token passed to cognito to get user pool details.
SDK clients also take a client name, to help identify where SDK requests are originating from - e.g. @servisbot/[email protected]
.
As an object
const fetch = require('node-fetch') || window.fetch;
const SB = require('@servisbot/sb-sdk')(fetch, "@servisbot/[email protected]");
const auth = new SB.Auth({
organization: '<Your Organization>',
bullseyeUrl:'<ServisBOT bullseye url>',
virtualAssistantUrl:'<ServisBOT virtual assistant url>',
brocaUrl:'<ServisBOT broca url>',
metrickyUrl:'<ServisBOT metricky url>',
credentials:{
accessKeyId: '<Access Key Id>',
secretAccessKey: '<Secret Access Key>',
sessionToken: '<Session Token>'
},
cognitoJwtToken: '<JWT Token>',
timezone:'<Your local timezone (optional)>'
});
As a function, async supported
const fetch = require('node-fetch') || window.fetch;
const SB = require('@servisbot/sb-sdk')(fetch, "@servisbot/[email protected]");
const auth = new SB.Auth({
organization: '<Your Organization>',
bullseyeUrl:'<ServisBOT bullseye url>',
credentials: () => async getYourCredentials(),
cognitoJwtToken: '<JWT Token>'
});