1.0.2 • Published 9 years ago
intercom_update_companies v1.0.2
Intercom Update Companies
Api
findUserAndUpdate(query, requiredCompanies, callback)
Queries the user in intercom.io and calls updateUserCompanies
with the users existing company array.
Arguments
query
- An object containing user_id or emailrequiredCompanies
- An array of company_idscallback(err)
- A callback which is called whenupdateCompanies
has finished.
Examples
var updateCompanies = require('intercom_update_companies');
var query = { user_id:'intercom user id' };
var requiredCompanies = [ company_id1, company_id2 ];
updateCompanies.findUserAndUpdate(query, requiredCompanies, callback);
updateUserCompanies(user_id, existingCompanies, requiredCompanies, callback)
Sets the users companies to existingCompanies
. If the array is empty, it will dissassociate all companies from the user.
Arguments
user_id
- The user_id in intercom.iorequiredCompanies
- An array of company objects { company_id:1 }callback(err)
- A callback which is called whenupdateCompanies
has finished.
Examples
var updateCompanies = require('intercom_update_companies');
var query = { user_id:'intercom user id' };
var requiredCompanies = [ {company_id:1} ];
updateCompanies.updateUserCompanies(user_id, requiredCompanies, callback);
Setup
npm install intercom_update_companies