Skip to content

Makes the Drip Node client available through Hapi mechanisms

Notifications You must be signed in to change notification settings

scoutforpets/hapi-drip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hapi-drip

Makes the Drip Node client available through Hapi mechanisms.

ONLY WORKS WITH HAPI V17+

Install

npm i hapi-drip

OR

yarn add hapi-drip

Usage

Here's a very simple example:

Registering the plugin

  const server = new Hapi.Server()
  const plugin = {
    plugin: require('hapi-drip'),
    options: { accountId: 'your account id', token: 'your api token' }
  }

  await server.register(plugin)

Accessing the plugin

The plugin is available at both server.drip and request.drip.

  server.route({
    method: 'GET',
    path: '/',
    config: {
      handler: (request, h) => {
        
        const { drip } = request;

        await drip.recordEvent({
            events: [{
                email: '[email protected]',
                action: 'Signed up'
            }]
        });
      }
    }
  })

More information

For details on drip-nodejs, click here.

For details on the Drip REST API, click here.

About

Makes the Drip Node client available through Hapi mechanisms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published