0.0.7 • Published 2 years ago
blaggo-blackbox v0.0.7
Blaggo Blackbox NodeJS Client SDK
API Documentation
Staging Environment
Production Environment
Getting Started
Installation
npm i blaggo-blackbox
Authentication
const blaggo = require("blaggo-blackbox");
// env can either be `test`, `stage`, or `prod`.
const options = {env: "test"};
// When `options` is not provided the `env` is considered `prod`
const res = await blaggo.Authenticate({
client_id: "API client id",
client_secret: "API client secret",
}, options);
console.log(res.data);
Blackbox Initialization
const blaggo = require("blaggo-blackbox");
// env can either be `test`, `stage`, or `prod`.
const options = {
env: "test",
credentials: {
client_id: "API client id",
client_secret: "API client secret",
}
};
const blackbox = new blaggo.Blackbox(options);
Inbox Messages
Getting Inbox Messages
// Other values for `status` can be found in the API docs. const unreads = await blackbox.getInboxMessages({status: "0"}); console.log(unreads);
Updating an Inbox Message
// Other values for `status` can be found in the API docs. const res = await blackbox.updateInboxMessage({ id: "message id", status: "3", }); console.log(res);
Sending Inbox Message
// Although `sender_id` is required, the logged in user will automatically // as the sender of the message. const res = await blackbox.createPayload({ sender_id: "blaggo user id", receiver_id: "blaggo user id", subject: "Test", body: "Test message", }); console.log(res);
Subscription
Getting Pending Subscriptions
// Other values for `status` can be found in the API docs. const res = await blackbox.querySubscribers({ status: "pending", }); console.log(res);
Updating Subscription
const res = await blackbox.createPayload({ aggregator_id: "blaggo biller id", customer_code: "QV2341TG", profile_id: "blaggo user id", status: "approved", }); console.log(res);