Skip to content

Latest commit

 

History

History
130 lines (75 loc) · 3.85 KB

README.md

File metadata and controls

130 lines (75 loc) · 3.85 KB

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

None.

Action Patterns

Action Descriptions

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

List Hubspot data into an entity.


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

Load Hubspot data into an entity.


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

Update/Save Hubspot data into an entity


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

Get information about the provider.