fix(server): Remove mailchimp step and journey ids (#4750)

* fix(server): Remove mailchimp step and journey ids

* Fix pre-commit - add end

* feat(server): use both onboardin and newsletter list audiences

* Fix type

* Remove unused triggerMailchimpCustomerJourney function

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
This commit is contained in:
andrewwallacespeckle
2025-05-15 12:24:50 +02:00
committed by GitHub
parent d90d503495
commit 2f17b3f8b8
6 changed files with 7 additions and 55 deletions
@@ -47,25 +47,6 @@ export async function addToMailchimpAudience(user: UserRecord, listId: string) {
})
}
export async function triggerMailchimpCustomerJourney(
user: UserRecord,
{
listId,
journeyId,
stepId
}: {
listId: string
journeyId: number
stepId: number
}
) {
await addToMailchimpAudience(user, listId)
// @ts-expect-error the mailchimp api typing sucks
await mailchimp.customerJourneys.trigger(journeyId, stepId, {
email_address: user.email
})
}
export async function updateMailchimpMemberTags(
user: UserRecord,
listId: string,
@@ -1,9 +1,6 @@
import { authLogger, type Logger } from '@/observability/logging'
import { loggerWithMaybeContext } from '@/observability/components/express/requestContext'
import {
addToMailchimpAudience,
triggerMailchimpCustomerJourney
} from '@/modules/auth/services/mailchimp'
import { addToMailchimpAudience } from '@/modules/auth/services/mailchimp'
import { UserEvents } from '@/modules/core/domain/users/events'
import {
enableMixpanel,
@@ -37,12 +34,12 @@ const onUserCreatedFactory =
// Set up mailchimp
if (getMailchimpStatus()) {
try {
const onboardingIds = getMailchimpOnboardingIds()
await triggerMailchimpCustomerJourney(user, onboardingIds)
const { listId: onboardingListId } = getMailchimpOnboardingIds()
await addToMailchimpAudience(user, onboardingListId)
if (newsletterConsent) {
const { listId } = getMailchimpNewsletterIds()
await addToMailchimpAudience(user, listId)
const { listId: newsletterListId } = getMailchimpNewsletterIds()
await addToMailchimpAudience(user, newsletterListId)
}
} catch (error) {
logger.warn({ err: error }, 'Failed to sign up user to mailchimp lists')
@@ -195,16 +195,10 @@ export function getMailchimpConfig() {
}
export function getMailchimpOnboardingIds() {
if (
!process.env.MAILCHIMP_ONBOARDING_LIST_ID ||
!process.env.MAILCHIMP_ONBOARDING_JOURNEY_ID ||
!process.env.MAILCHIMP_ONBOARDING_STEP_ID
)
if (!process.env.MAILCHIMP_ONBOARDING_LIST_ID)
throw new MisconfiguredEnvironmentError('Mailchimp onboarding is not configured')
return {
listId: process.env.MAILCHIMP_ONBOARDING_LIST_ID,
journeyId: parseInt(process.env.MAILCHIMP_ONBOARDING_JOURNEY_ID),
stepId: parseInt(process.env.MAILCHIMP_ONBOARDING_STEP_ID)
listId: process.env.MAILCHIMP_ONBOARDING_LIST_ID
}
}
@@ -959,12 +959,6 @@ Generate the environment variables for Speckle server and Speckle objects deploy
- name: MAILCHIMP_ONBOARDING_LIST_ID
value: "{{ .Values.server.mailchimp.onboardingListId}}"
- name: MAILCHIMP_ONBOARDING_JOURNEY_ID
value: "{{ .Values.server.mailchimp.onboardingJourneyId}}"
- name: MAILCHIMP_ONBOARDING_STEP_ID
value: "{{ .Values.server.mailchimp.onboardingStepId}}"
{{- end }}
# Monitoring - Apollo
@@ -1491,16 +1491,6 @@
"type": "string",
"description": "Audience id for the onboarding list",
"default": ""
},
"onboardingJourneyId": {
"type": "string",
"description": "Id of the onboarding journey",
"default": ""
},
"onboardingStepId": {
"type": "string",
"description": "Id of the onboarding journey step we trigger",
"default": ""
}
}
},
-4
View File
@@ -889,10 +889,6 @@ server:
newsletterListId: ''
## @param server.mailchimp.onboardingListId Audience id for the onboarding list
onboardingListId: ''
## @param server.mailchimp.onboardingJourneyId Id of the onboarding journey
onboardingJourneyId: ''
## @param server.mailchimp.onboardingStepId Id of the onboarding journey step we trigger
onboardingStepId: ''
migration:
## @param server.migration.movedFrom Indicate the URL where the server moved from