From a3d4bed3b13ff28e644fc398fdce048b3a67bb23 Mon Sep 17 00:00:00 2001 From: Marco Ponchia Date: Thu, 19 Dec 2024 18:15:03 +0100 Subject: [PATCH] fix make payload --- .../active-campaign-client/src/helpers/addOrUpdateContact.ts | 2 +- .../active-campaign-client/src/helpers/makeContactPayload.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/active-campaign-client/src/helpers/addOrUpdateContact.ts b/packages/active-campaign-client/src/helpers/addOrUpdateContact.ts index 6d1a4f0b2..421048a69 100644 --- a/packages/active-campaign-client/src/helpers/addOrUpdateContact.ts +++ b/packages/active-campaign-client/src/helpers/addOrUpdateContact.ts @@ -3,9 +3,9 @@ import { makeContactPayload } from './makeContactPayload'; import { acClient } from '../clients/activeCampaignClient'; export async function addOrUpdateContact(user: User) { - const acPayload = makeContactPayload(user); const contactId = await acClient.getContactByCognitoId(user.username); + const acPayload = makeContactPayload(user); const { contact } = contactId ? await acClient.updateContact(contactId, acPayload) : await acClient.createContact(acPayload); diff --git a/packages/active-campaign-client/src/helpers/makeContactPayload.ts b/packages/active-campaign-client/src/helpers/makeContactPayload.ts index 8dbca2202..f848b453e 100644 --- a/packages/active-campaign-client/src/helpers/makeContactPayload.ts +++ b/packages/active-campaign-client/src/helpers/makeContactPayload.ts @@ -4,8 +4,7 @@ import { User } from '../types/user'; export function makeContactPayload(user: User): ContactPayload { return { contact: { - // email: user.email, - email: '', + email: user.email, firstName: user.given_name, lastName: user.family_name, phone: `cognito:${user.username}`,