@madkudu/hubspot
v1.0.0-beta3
Published
A node wrapper for the HubSpot API
Downloads
11
Keywords
Readme
node-hubspot
Node.js wrapper for the HubSpot API
Installing
npm install @madkudu/hubspot
Usage
const Hubspot = require('hubspot');
const hubspot = new Hubspot({ apiKey: 'abc' });
You can also authenticate via token:
const hubspot = new Hubspot({ accessToken: 'abc' });
To change the base url
const hubspot = new Hubspot({ accessToken: 'abc', baseUrl: 'https://some-url' });
And then use the API method via:
hubspot.contacts.get(options)
.then(results => {
console.log(results)
}).catch(err => {
console.error(err)
})
or if you prefer callbacks:
hubspot.contacts.get(function(err, results) {
if (err) { console.error(err) }
console.log(results);
});
Available Methods
Companies
hubspot.companies.get(opts, cb)
hubspot.companies.getById(id, cb)
hubspot.companies.getRecentlyCreated(opts, cb)
hubspot.companies.getRecentlyModified(opts, cb)
hubspot.companies.getByDomain(domain, cb)
hubspot.companies.create(data, cb)
hubspot.companies.addContactToCompany(data, cb); // data = { companyId: 123, contactVid: 123 }
Contacts
hubspot.contacts.get(opts, cb)
hubspot.contacts.getByEmail(email, cb)
hubspot.contacts.getByEmailBatch(emails, cb)
hubspot.contacts.getById(id, cb)
hubspot.contacts.getByIdBatch(ids, cb)
hubspot.contacts.update(id, data, cb)
hubspot.contacts.create(data, cb)
hubspot.contacts.createOrUpdateBatch(data, cb)
hubspot.contacts.search(query, cb)
hubspot.contacts.getRecent(cb)
hubspot.contacts.createOrUpdate(email, data, cb)
hubspot.contacts.properties.get(cb)
Deals
hubspot.deals.get(opts, cb)
hubspot.deals.getRecentlyModified(opts, cb)
hubspot.deals.getRecentlyCreated(opts, cb)
hubspot.deals.getById(id, cb)
hubspot.deals.deleteById(id, cb)
hubspot.deals.updateById(id, data, cb)
hubspot.deals.create(data, cb)
hubspot.deals.associate(id, objectType, associatedObjectId, cb)
hubspot.deals.removeAssociation(id, objectType, associatedObjectId, cb)
Engagements
hubspot.engagements.create(data, cb)
Owners
hubspot.owners.get(opts, cb)
Pipelines
hubspot.pipelines.get(opts, cb)
Lists
hubspot.lists.get(opts, cb)
hubspot.lists.getOne(id, cb)
hubspot.lists.getContacts(id, opts, cb)
hubspot.lists.getRecentContacts(id, opts, cb)
hubspot.lists.addContacts(id, contactBody, cb)
Files
hubspot.files.get(cb)
hubspot.files.getOne(id, cb)
hubspot.subscriptions.get(opts, cb)
### Email Events
```javascript
hubspot.campaigns.get(opts, cb)
hubspot.campaigns.getOne(id, appId, cb)
hubspot.campaigns.events(opts, cb)
Social Media
hubspot.broadcasts.get(opts, cb)
License
MIT
Contributors
Brian Falk @brainflake Tim Atkinson @timisbusy Tejas Manohar @tejasmanohar Krispin Schulz @kr1sp1n Filipe Ferreira @iTsFILIPOficial Paul Cothenet @pcothenet