Superface

Track Event for Contact

crm/track-contact-event@1.0.0
1 provider

Track Contact Event

Sends an event data to CRM for a specific contact

Input
Contact Identifier
Event Name
Event Properties
Result
Contact Identifier

1.Choose a provider

2.Use TrackContactEvent with mock in your code

Below instructions are for our Node.js SDK. Use OneService for other languages.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('crm/track-contact-event@1.0.0');

  // Use the profile
  const result = await profile
    .getUseCase('TrackContactEvent')
    .perform({
      contactId: 'example.user@email.com',
      eventName: 'order-created',
      eventProperties: {
        orderId: 'nYRe6bt97oLrH4g5Ssak6',
        totalAmount: '42',
        currency: 'EUR'
      }
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

contactId
A value that uniquely identifies a contact. Each provider might use a different identifier (e.g. email or random number).
eventName
A text value representing the event name
eventProperties
Event Properties are attributes that help you define the specifics of an Event.

Example

{
  "contactId": "example.user@email.com",
  "eventName": "order-created",
  "eventProperties": {
    "orderId": "nYRe6bt97oLrH4g5Ssak6",
    "totalAmount": "42",
    "currency": "EUR"
  }
}

Result (object)

contactId
A value that uniquely identifies a contact. Each provider might use a different identifier (e.g. email or random number).

Example

{
  "contactId": "example.user@email.com"
}

Implementation details

Provider
mock
Use case
TrackContactEvent
Author
@superface
Source
Verified