Node.js Server

This guide shows how to emit events from an internal node.js server

Create a Source Connection

The Node.js Source lets you securely emit custom events from internal servers. To get started using the Developer Dashboard, simply follow these steps:
Step 1: Click the Sources tab of the dashboard
Step 2: Click the + New button
Step 3: Select the Node.js Source from the catalog
Step 4: Name the connection
Step 5: Click Connect
Once connected, you're ready to start configuring your custom event types.

Create your custom Event Types

Event lets you set custom event types for the various types of events you'd like to ingest from your servers. To create custom events:
Step 1: Go to the Sources tab of the Developer Dashboard
Step 2: Click on an existing Node.js Source to open it
Step 3: Click the Setup tab
Step 4: In the Manage Events section, click the + Add New Event button
Step 5: Type the events you'd like to ingest
You can add multiple event types at the same time using comma separated values (i.e., user.created, user.updated, invoice.created)
Step 6: Click Add
Now that your custom event types are added, it's time to emit them from your server.

Emit Events from the Server

Step 1: Copy your Secret Key
Your Node.js has a unique Secret Key that you'll now use to authenticate from your server.
To find and copy your key, simply open the Node.js source from your Developer Dashboard, scroll down to the Secret Key section and click copy.
Step 2: Install the package
To start emitting events, install the package:
npm install @event-inc/emit
Step 3: Initialize
Run the following snippet to initialize the Node SDK. It creates a global Event client object that can be used for all the subsequent event requests.
import { createClient } from "@event-inc/emit";
const client = createClient(process.env.EVENT_INC_SECRET_KEY);
Step 4: Emit your event
The emit method lets you create and package an event with a name and a payload. A sample emit call is as shown:
client.emit("user.created", {
name: "John Doe",
The emit parameters are described below:
The name of the event
The data associated with the event

View Live Events

Once your server is emitting events, you'll start to see them arrive in your Live Event tab of the Developer Dashboard.