drip-nodejs
drip-nodejs copied to clipboard
Documentation is incorrect for "Record an event"
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: "[email protected]",
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: "[email protected]",
action: "Logged in",
properties: {
affiliate_code: "XYZ"
}
};
client.recordEvent(payload)
.then((response) => {
// Handle `response.body`
})
.catch((error) => {
// Handle errors
});
Please update the documentation.
Thanks!