Enrich new user data with a webhook and post results to Slack
SLACK_WEBHOOK_URL. See the docs for Sending Slack messages for more info.main.test.ts to test that your enrichment works. You should see a message in your Slack channel.This val uses Clay under the hood to provide user enrichments. The Val Town Clay Proxy is only available to paying Val Town Team accounts. To sign up to use this val, please send an email to enrichment@val.town.
To make this more secure, you can optionally set a WEBHOOK_SECRET environment variable and only accept requests that use the secret when posting.
// Add this to `main.ts` to only accept requests that include the secret
const secret = req.headers.get("Authorization");
if (secret !== `Bearer ${Deno.env.get("WEBHOOK_SECRET")}`) {
return new Response("Unauthorized", {
status: 401,
});
}