Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is incorrect for "Record an event" #42

Open
victorcarvalhosp opened this issue Oct 15, 2021 · 0 comments
Open

Documentation is incorrect for "Record an event" #42

victorcarvalhosp opened this issue Oct 15, 2021 · 0 comments

Comments

@victorcarvalhosp
Copy link

victorcarvalhosp commented Oct 15, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant