Skip to content

senecajs/seneca-hubspot-provider

Repository files navigation

Seneca Hubspot-Provider

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.

npm version build Coverage Status Known Vulnerabilities DeepScan grade Maintainability

Voxgig This open source module is sponsored and supported by Voxgig.

Quick Example

// 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)

Install

$ npm install @seneca/hubspot-provider

Options

  • 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: ... } }

Action Patterns

Action Descriptions

« role:entity,base:hubspot,cmd:load,name:company,zone:provider »

Load Hubspot company data into an entity.


« role:entity,base:hubspot,cmd:save,name:company,zone:provider »

Update Hubspot company data from an entity.


« sys:provider,get:info,provider:hubspot »

Get information about the provider.


About

Seneca plugin that provides access to the HubSpot API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published