mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-07-21 21:13:45 +08:00
Disable daily churn analysis cron
This commit is contained in:
parent
9d2d7ead8e
commit
fa2e2e92f4
1
.github/workflows/daily.yml
vendored
1
.github/workflows/daily.yml
vendored
@ -23,7 +23,6 @@ jobs:
|
||||
POSTHOG_API_HOST: "${{ secrets.POSTHOG_API_HOST }}"
|
||||
POSTHOG_PERSONAL_API_KEY: "${{ secrets.POSTHOG_PERSONAL_API_KEY }}"
|
||||
STRIPE_SECRET_KEY: "${{ secrets.STRIPE_SECRET_KEY }}"
|
||||
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
|
||||
DISCORD_CHANNEL_ID: "${{ secrets.DISCORD_CHANNEL_ID }}"
|
||||
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
|
||||
steps:
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { formatChurnAgentDiscordMessages } from "../churnAgent/formatChurnAgentDiscordMessages";
|
||||
import { getYesterdayChurnSummary } from "../churnAgent/getYesterdayChurnSummary";
|
||||
import { cleanExpiredData } from "../helpers/cleanExpiredData";
|
||||
import { formatSubscriptionMessage } from "../helpers/formatSubscriptionMessage";
|
||||
import { getLandingPageVisitors } from "../helpers/getLandingPageVisitors";
|
||||
@ -32,32 +30,6 @@ ${formatSubscriptionMessage(subscriptionTransitions)}
|
||||
channelId: process.env.DISCORD_CHANNEL_ID!,
|
||||
},
|
||||
);
|
||||
|
||||
if (!process.env.DISCORD_CHANNEL_ID) {
|
||||
console.log("DISCORD_CHANNEL_ID is not set, skipping churn agent");
|
||||
return;
|
||||
}
|
||||
|
||||
await getYesterdayChurnSummary({
|
||||
onSummaryGenerated: async (churnSummary) => {
|
||||
const totalSpent = churnSummary.workspace.totalSpent
|
||||
? parseFloat(
|
||||
churnSummary.workspace.totalSpent.replace(/[^0-9.-]+/g, ""),
|
||||
)
|
||||
: 0;
|
||||
|
||||
const isLowSpender = totalSpent < 100;
|
||||
await sendDiscordMessage(
|
||||
formatChurnAgentDiscordMessages(churnSummary, {
|
||||
excludeTimeline: isLowSpender,
|
||||
excludeEmailSuggestion: isLowSpender,
|
||||
}),
|
||||
{
|
||||
channelId: process.env.DISCORD_CHANNEL_ID!,
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
main().then();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user