DiscordAPI
Send Discord messages from your code
Post to a Discord channel through a webhook you create yourself. No bot to install and no OAuth dance, and the 2000 character limit is checked before the message is sent.
What you can build
Notify the channel on every deploy
The message lands under the webhook's own name and avatar.
import { yeetpost } from "yeetpost";
await yeetpost({
connection: "discord",
text: `deploy ${version} finished, all checks green`,
});Fan out to Discord and Telegram in one call
One request, one result per connection, in the order the slugs were given.
const response = await fetch("https://api.yeetpost.com/api/v2/posts", {
method: "POST",
headers: {
"x-api-key": process.env.YEETPOST_API_KEY,
"content-type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
text: "incident resolved, dashboards are back",
connectionSlugs: ["discord", "telegram"],
}),
});
const data = await response.json();
for (const result of data.results) {
console.log(result.connectionSlug, result.status, result.url);
}Handle a webhook that was deleted
A webhook that is gone comes back platform_rejected, and the other connections still go out.
const discord = data.results.find((r) => r.connectionSlug === "discord");
if (discord.status === "failed") {
console.error(discord.error.error, discord.error.message);
}Related features
- Message Discord from your terminal
- Automate LinkedIn posts from your code
- Post to X programmatically
- Post to Bluesky from your code
Explore the full catalog on the features hub.
Related resources
Ready to get started?
Start posting to Discord in minutes.