1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook?v=3";
import { secrets } from "https://esm.town/v/me/secrets";
// Triggered when someone tells us how they hear about VT on onboarding
export async function handleOnboardingReferral({ auth, referral, handle }: {
auth: string;
referral: string;
handle: string;
}) {
// check custom auth secret sent from clerk
if (auth !== secrets.handleOnboardingReferral)
return false;
if (!referral.trim().length)
return;
await discordWebhook({
url: secrets.newUserDiscord,
content: handle + "heard about us from " + referral,
});
return true;
}
// Forked from @stevekrouse.handleOnboardingReferral