A library for integrating with SubscriptionFlow.
npm install @subscriptionflow-developer/subscriptionflow-node
This is the node.js Library for integrating with SubscriptionFlow. Sign up for a SubscriptionFlow account here.
MIT
```
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.
`JavaScript`
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.
`JavaScript`
//Get all the products
products = await sFlow.products.get();`JavaScript`
//Get a product by id
product = await sFlow.products.getById(recordId);`JavaScript
let createRecordData = {
"name": "Test product",
"description": "Test product created using api",
"type": "Base Products",
"status": "Active"
}
//Create Record
product = await sFlow.products.create(createRecordData);
``JavaScript
let updateRecordData = {
"name": "Edited Test product"
}
//Update record
product = await sFlow.products.updateById(recordId, updateRecordData);
``JavaScript
//Delete record
product = await sFlow.products.deleteById(recordId);
``