This is the node.js Library for integrating with SubscriptionFlow. Sign up for a SubscriptionFlow account here.
MIT
This library is intended to interact with the Subscription Flow api, so first of all we need an account there. Once you are logged in your account you can get the base url of your instance in the address bar, it should look like "https://example.subscriptionflow.com". Then you should go to Administration Settings > USERS AND CONTROL > OAuth Clients, there you can create the OAuth Client and copy the client id and client secret.
Inside a node project you can install the library running:
npm i @subscriptionflow-developer/subscriptionflow-node
Once the library is installed import and instantiate it passing the base url, client id and client secret that we mentioned before.
const SFlow = require('@subscriptionflow-developer/subscriptionflow-node');
var sFlow = new SFlow(base_url, client_id, client_secret);
After that we can call the methods in the format <Subscriptionflow object>.<module>.<method()>. See examples of common methods below.
//Get all the products
products = await sFlow.products.get();
//Get a product by id
product = await sFlow.products.getById(recordId);
let createRecordData = {
"name": "Test product",
"description": "Test product created using api",
"type": "Base Products",
"status": "Active"
}
//Create Record
product = await sFlow.products.create(createRecordData);
let updateRecordData = {
"name": "Edited Test product"
}
//Update record
product = await sFlow.products.updateById(recordId, updateRecordData);
//Delete record
product = await sFlow.products.deleteById(recordId);