hapi-drip

Makes the Drip Node client available through Hapi mechanisms.

Usage no npm install needed!

<script type="module">
  import hapiDrip from 'https://cdn.skypack.dev/hapi-drip';
</script>

README

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: 'ned@stark.org',
                action: 'Signed up'
            }]
        });
      }
    }
  })

More information

For details on drip-nodejs, click here.

For details on the Drip REST API, click here.