Skip to main content

Quick start

This guide sends one event and receives it on your machine.

Prerequisites​

  • Node.js 20 or later
  • A Hookline account and a test API key

Install the SDK​

npm install @hookline/sdk

Send your first event​

Create a file named send.mjs:

import { Hookline } from '@hookline/sdk';

const hookline = new Hookline(process.env.HOOKLINE_API_KEY);

const event = await hookline.events.create({
type: 'invoice.paid',
payload: { invoiceId: 'inv_1042', amount: 4900 },
});

console.log(event.id, event.status);

Run it with your test key:

HOOKLINE_API_KEY=hl_test_replace_me node send.mjs

The output is an event ID and the status queued.

Receive the event locally​

Start the CLI listener in a second terminal:

npx hookline listen --forward-to http://localhost:3000/webhooks

The listener prints each event and forwards it to your local server.

tip

Keep the listener running while you build. Each retry appears in the same terminal.

Next steps​

Read authentication before you move to live keys.