Skip to content

Commit

Permalink
reverting check for traits in message root
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Feb 24, 2021
1 parent 62af828 commit fc5547a
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions integrations/Klaviyo/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,22 @@ class Klaviyo {

identify(rudderElement) {
const { message } = rudderElement;
let traitsInfo;
if (message.context.traits) {
traitsInfo = message.context.traits;
} else if (message.traits) {
traitsInfo = message.traits;
} else {
if (!(message.context && message.context.traits)) {
logger.error("user traits not present");
return;
}

let payload = {
$id: message.userId,
$email: traitsInfo.email,
$phone_number: traitsInfo.phone,
$first_name: traitsInfo.firstName,
$last_name: traitsInfo.lastName,
$organization: traitsInfo.organization,
$title: traitsInfo.title,
$city: traitsInfo.city,
$region: traitsInfo.region,
$country: traitsInfo.country,
$zip: traitsInfo.zip,
$email: message.context.traits.email,
$phone_number: message.context.traits.phone,
$first_name: message.context.traits.firstName,
$last_name: message.context.traits.lastName,
$organization: message.context.traits.organization,
$title: message.context.traits.title,
$city: message.context.traits.city,
$region: message.context.traits.region,
$country: message.context.traits.country,
$zip: message.context.traits.zip,
};
if (!payload.$email && !payload.$phone_number) {
logger.error("user phone or email not present");
Expand Down

0 comments on commit fc5547a

Please sign in to comment.