emailToDiscordWebhook
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
First, create a Discord Webhook and add it to your Val.town environment variables.
Then create an Email Val:
import { getEmailHandler } from "https://esm.town/v/wilt/emailToDiscordWebhook?v=19";
// e.g. ["email@example.com", "otherEmail.address.biz"]
const senderAllowlist = JSON.parse(Deno.env.get("DISCORD_EMAIL_ALLOWLIST") || "[\"*\"]");
const webhookUrl = Deno.env.get("MY_DISCORD_WEBHOOK")!;
export default getEmailHandler({
replyToSender: false,
senderAllowlist,
webhookUrl,
});
Now, whenever you send an email to your email val, it will be forwarded to your Discord webhook