1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail";
export let welcomeEmailTest = console.email({
html: welcomeEmail,
subject: `Welcome to Val Town`,
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export const jsPython = (async () => {
const { jsPython } = await import("npm:jspython-interpreter");
const script = `
def mapFunction(r, i):
v = r * i
return v
x = [1, 2, 3, 4]
x
.map(mapFunction)
.filter(r => r * r)
.join(",")
`;
const interpreter = jsPython();
return interpreter.evaluate(script);
})();
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rhi/welcomeEmail";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});

Welcome new users to Val Town

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
import { html } from "https://esm.town/v/stevekrouse/html";
import { welcomeEmail } from "https://esm.town/v/stevekrouse/welcomeEmail";
import sgMail from "npm:@sendgrid/mail";
sgMail.setApiKey(Deno.env.get("sendgrid"));
export async function newUserWelcomeEmail(req: Request): Promise<Response> {
if (req.method === "GET") return html(welcomeEmail);
if (req.headers.get("clerkNonSensitive") !== Deno.env.get("clerkNonSensitive"))
return new Response("Not authorized", { status: 401 });
let { data } = await req.json();
// notify the team discord
await discordWebhook({
url: Deno.env.get("discordUserEvents"),
content: "New user! " + data.email_addresses[0].email_address
+ " "
+ data.profile_image_url,
});
// welcome the user!
await sgMail.send({
subject: "Welcome to Val Town!",
from: "Steve Krouse <steve@val.town>",
to: data.email_addresses[0].email_address,
html: welcomeEmail,
});
return Response.json("ok"); // tell Clerk we got the wehbook
}
1
2
3
4
5
6
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
});