Skip to content

Documentation is incorrect for "Record an event" #42

@victorcarvalhosp

Description

@victorcarvalhosp

Hi guys,

Looking into the Javascript tab in the "Record an event" section in the documentation we can see the following code:

const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID });
const payload = {
  events: [{
    email: "john@acme.com",
    action: "Logged in",
    properties: {
      affiliate_code: "XYZ"
    }
  }]
};

client.recordEvent(payload)
  .then((response) => {
    // Handle `response.body`
  })
  .catch((error) => {
    // Handle errors
  });

But this payload is wrong and returns an error:
"JSON parsing error: The property '#/' of type object did not match one or more of the required schemas\"

The correct code should be:

const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID });
const payload = {
    email: "john@acme.com",
    action: "Logged in",
    properties: {
      affiliate_code: "XYZ"
    }
};

client.recordEvent(payload)
  .then((response) => {
    // Handle `response.body`
  })
  .catch((error) => {
    // Handle errors
  });

Please update the documentation.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions