• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dk3

dk3

discordWebhook

Helper function to send Discord messages
Remix of stevekrouse/discordWebhook
Public
Like
discordWebhook
Home
Code
2
README.md
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
12/5/2025
README.md

Send a Discord message

Send a message to a Discord channel. It's useful for notifying your team or community when someone interesting happens, like a user signup, Stripe payment, mention on social media, etc.

Usage

1. Create a Discord Webhook

Follow the instructions here. It only takes a minute.

2. Copy webhook URL

Paste the webhook URL into your val's environment variables as DISCORD_WEBHOOK_URL.

3. Send a message!

Create val
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook/main.ts"; await discordWebhook({ content: "Hi from val town!" });

Parameters

content

Any text, rendered as markdown. If over 2000 characters, we will truncate it to the first 2000 for you.

url

You can pass the webhook url as a parameter explicitly. Otherwise, this helper function will implicitly look in your env variables under DISCORD_WEBHOOK_URL.

flags

ie "SUPPRESS_EMBEDS". Learn more about flag options here.

Contributing

This helper function only supports content and flags as parameters. There are other parameters that Discord supports. PRs welcome!

Get started with a template:
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.