Plunk NPM Package

When sending events to Plunk from Node.js, you can use the Plunk NPM Package. This package is a simple API wrapper that also offers full TypeScript support.

Bubble

Installation

Before you can get started, you need to install the package in your project using your favourite package manager.

npm i @plunk/node

Plunk Client

All interactions with Plunk happen through the Plunk client which you should only make once and reuse in your entire project.

1import Plunk from '@plunk/node'; 
2            
3const plunk = new Plunk("your-api-key");

Sending an event

Once you have created the client, you can use it send events to your Plunk dashboard.

1const success = await plunk.events.publish({
2    event: 'my-event',
3    email: 'hello@useplunk.com'
4});