Skip to content

Commit

Permalink
Add skip_merge_validation flag when updating Mailchimp
Browse files Browse the repository at this point in the history
  • Loading branch information
wpf500 committed Aug 7, 2024
1 parent a95ad8d commit 6e999f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/providers/newsletter/MailchimpProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ interface Batch {
interface OperationNoBody {
method: "GET" | "DELETE" | "POST";
path: string;
params?: string;
operation_id: string;
body?: undefined;
}

interface OperationWithBody {
method: "POST" | "PATCH" | "PUT";
path: string;
params?: Record<string, string>;
body: string;
operation_id: string;
}
Expand Down Expand Up @@ -242,7 +244,8 @@ export default class MailchimpProvider implements NewsletterProvider {
): Promise<void> {
await this.instance.put(
this.emailUrl(oldEmail),
nlContactToMCMember(member)
nlContactToMCMember(member),
{ params: { skip_merge_validation: true } }
);
}

Expand All @@ -251,6 +254,7 @@ export default class MailchimpProvider implements NewsletterProvider {
const mcMember = nlContactToMCMember(contact);
return {
path: this.emailUrl(contact.email),
params: { skip_merge_validation: "true" },
method: "PUT",
body: JSON.stringify({ ...mcMember, status_if_new: mcMember.status }),
operation_id: `update_${contact.email}`
Expand Down

0 comments on commit 6e999f0

Please sign in to comment.