Seneca Hubspot-Provider is a plugin for Seneca
Provides access to the Hubspot API using the Seneca provider convention. Hubspot API entities are represented as Seneca entities so that they can be accessed using the Seneca entity API and messages.
This open source module is sponsored and supported by Voxgig. |
---|
// Setup - get the key value (<SECRET>) separately from a vault or
// environment variable.
Seneca()
.use('env', { // the 'env' plugin enables you to use environment variables in your Seneca instance.
// debug: true,
file: [__dirname + '/local-env.js;?'], // you can specify the file with your company's data such as id, etc.
var: {
$HUBSPOT_ACCESS_TOKEN: '<SECRET>',
}
})
.use('provider', {
provider: {
hubspot: {
keys: {
accessToken: {
value: '$HUBSPOT_ACCESS_TOKEN'
},
}
}
}
})
.use('hubspot-provider')
let companyId = await seneca.entity('provider/hubspot/company')
.load$('id')
// .load({id: 'id', fields$: ['state', 'city', 'description']}); // you can use fields$_directive to specify the properties you want to get from a company
Console.log('COMPANY DATA', companyId)
companyId.properties.description = 'New description'
companyId = await companyId.save$()
Console.log('UPDATED DATA', companyId)
$ npm install @seneca/hubspot-provider
debug
: boolean false
Set plugin options when loading with:
seneca.use('hubspot-provider', { name: value, ... })
Note: foo.bar
in the list above means
{ foo: { bar: ... } }
- role:entity,base:hubspot,cmd:load,name:company,zone:provider
- role:entity,base:hubspot,cmd:save,name:company,zone:provider
- sys:provider,get:info,provider:hubspot
Load Hubspot company data into an entity.
Update Hubspot company data from an entity.
Get information about the provider.