Links

Add to your frontend

In your backend, create a request to fetch a link_token from Cobalt.
Include the following parameters:
  • linked_account_id : A unique id for the entity that was used while creating the Linked Account.
This request will return the following:
  • link_token: Temporary token initializing your user’s integration session.
Javascript
/**
* getTokenForLinkedAccount
* @param {String} linked_account_id
* @returns {Promise<Token>}
*/
const getTokenForLinkedAccount = async (linked_account_id) => {
return new Promise((resolve, reject) => {
try {
resolve(Client.getTokenForLinkedAccount({
linked_account_id: linked_account_id
}));
} catch (error) {
reject(error);
}
});
};

Step 2: Server - Dispay applications, templates & workflows

In your backend, use the below API calls to get the list of applications, templates and workflows assigned in a specific embed.
  • Get all applications
  • Get all templates
  • Get all templates for authorised apps
  • Get installed workflows
Get All Application
In your backend, create a request to fetch a list of applications added in an embed from Cobalt.
Include the following parameters:
  • linked_account_id : A unique id for the entity that was used while creating the Linked Account.
Javascript
/**
* Get Applications
* @param {String} linked_account_id expects an email id or unique id.
* @param {String} page page number to get.
* @param {String} limit number of records to fetch.
* @returns {Promise<Applications>}
*/
const getApplications = async (linked_account_id, page, limit) => {
return new Promise(async (resolve, reject) => {
try {
resolve(Client.getApplications(linked_account_id, {
page: page,
limit: limit
}))
} catch (error) {
reject(error);
}
});
};
Get Templates
In your backend, create a request to fetch a list of templates added in an embed from Cobalt.
Include the following parameters:
  • linked_account_id : A unique id for the entity that was used while creating the Linked Account.
Javascript
/**
* Get All Published Templates
* @param {String} linked_account_id expects an email id or unique id.
* @param {String} page page number to get.
* @param {String} limit number of records to fetch.
* @returns {Promise<Template>}
*/
const getAllTemplates = async (linked_account_id, page, limit) => {
return new Promise(async (resolve, reject) => {
try {
resolve(Client.getAllTemplates(linked_account_id, {
page: page,
limit: limit
}))
} catch (error) {
reject(error);
}
});
};
Get templates for Authorised Apps
In your backend, create a request to fetch a list of templates for the application which are successfully authorised by your end user.
Include the following parameters:
  • linked_account_id : A unique id for the entity that was used while creating the Linked Account.
Javascript
v/**
* Get Templates For ConnectedApps
* @param {String} linked_account_id expects an email id or unique id.
* @param {String} page page number to get.
* @param {String} limit number of records to fetch.
* @returns {Promise<Templates>}
*/
const getTemplatesForConnectedApps = async (linked_account_id, page, limit) => {
return new Promise(async (resolve, reject) => {
try {
resolve(Client.getTemplatesForConnectedApps(linked_account_id, {
page: page,
limit: limit
}))
} catch (error) {
reject(error);
}
});
};
Get installed workflow
In your backend, create a request to fetch a list of installed workflow by your end user.
Include the following parameters:
  • linked_account_id : A unique id for the entity that was used while creating the Linked Account.
  • udf : A user defined field which can be used to filter and get specific set of installed workflow. Udf parameter is set during the installation of a template
Javascript
/**
* Get All Workflow
* @param {String} linked_account_id expects an email id or unique id.
* @param {String} page page number to get.
* @param {String} limit number of records to fetch.
* @returns {Promise<Workflow>}
*/
const getWorkflows = async (linked_account_id, page, limit, udf) => {
return new Promise(async (resolve, reject) => {
try {
resolve(Client.getWorkflows(linked_account_id, {
page: page,
limit: limit,
udf: udf
}))
} catch (error) {
reject(error);
}
});
};
module.exports = {
getWorkflows
};
In your frontend, use our frontend SDK @cobaltio/react-cobalt-js to open your user’s integration authorization session and template installer.
You can also use your own components for rendering by using our custom JavaScript SDK @cobaltio/cobalt-js.
npm: @cobaltio/cobalt-js
npm
Custom Javascript SDK