space out onboarding emails

This commit is contained in:
mantikoros 2022-09-20 15:56:28 -05:00
parent ac952f1164
commit 8920241c39

View File

@ -23,15 +23,21 @@ export const onCreateUser = functions
await sendWelcomeEmail(user, privateUser)
const guideSendTime = dayjs().add(28, 'hours').toString()
await sendCreatorGuideEmail(user, privateUser, guideSendTime)
const followupSendTime = dayjs().add(48, 'hours').toString()
await sendPersonalFollowupEmail(user, privateUser, followupSendTime)
// skip email if weekly email is about to go out
const day = dayjs().utc().day()
if (day === 0 || (day === 1 && dayjs().utc().hour() <= 19)) return
const skipInterestingMarkets =
// skip email if weekly email is about to go out
day === 0 || (day === 1 && dayjs().utc().hour() <= 19)
const guideSendTime = dayjs()
.add(skipInterestingMarkets ? 24 : 96, 'hours')
.toString()
await sendCreatorGuideEmail(user, privateUser, guideSendTime)
if (skipInterestingMarkets) return
const contracts = await getTrendingContracts()
const marketsSendTime = dayjs().add(24, 'hours').toString()