Step 1. Create an input

1. Generate your API key

Create a Custom Feed on the Setup page to generate server-to-server API credentials.

2. Install the Node SDK

Install the Node SDK via npm:

npm install mparticle

3. Call the Events API

Integrate mparticle in your Node app.

var mParticle = require('mparticle');

var api = new mParticle.EventsApi(new mParticle.Configuration(

var batch = new mParticle.Batch(mParticle.Batch.Environment.development);

batch.user_identities = new mParticle.UserIdentities();
batch.user_identities.customerid = '123456' // identify the user (required)

batch.user_attributes = {'hair color': 'brown'}

var event = new mParticle.AppEvent(mParticle.AppEvent.CustomEventType.navigation, 
  'Hello World');


var body = [batch]; // {[Batch]} Up to 100 Batch objects

var callback = function(error, data, response) {
  if (error) {
  } else {
    console.log('API called successfully.');

api.bulkUploadEvents(body, callback);

4. Verify installation

Go to the Live Stream and watch new events come in as you run your script.

Next Steps 🎉

Congrats on sending your first event to mParticle!

Some suggestions on what to do next:

Was this page helpful?