formcord
v1.0.0
Published
Lightweight Discord notifications using only Web APIs
Maintainers
Readme
Formcord
Lightweight, universal notifications to Discord using only Web APIs.
Requirements
Node 18+ or any runtime with fetch support
Install
npm install formcordDiscord Bot Setup
- Create an app and bot in the Discord Developer Portal.
- Copy the bot token.
- Invite the bot to your server with permission to send messages.
- Get the channel ID (enable Developer Mode, then copy ID).
Quick Usage
import { formcord } from "formcord";
await formcord.contact({
token: process.env.FORMCORD_DISCORD_TOKEN!,
channelId: process.env.FORMCORD_DISCORD_CHANNEL!,
subject: "Hello",
email: "[email protected]",
message: "This is a test",
});API
contact
formcord.contact({
token,
channelId,
subject,
email,
message,
throwOnError,
content,
theme,
});error
formcord.error({
token,
channelId,
error,
source,
environment,
throwOnError,
content,
theme,
});deploy
formcord.deploy({
token,
channelId,
project,
environment,
url,
commit,
throwOnError,
content,
theme,
});feedback
formcord.feedback({
token,
channelId,
rating,
message,
throwOnError,
content,
theme,
});bug
formcord.bug({
token,
channelId,
title,
steps,
browser,
throwOnError,
content,
theme,
});Theming and Content
You can add a top message with content and customize embed styling with theme.
formcord.contact({
token,
channelId,
subject: "Hello",
email: "[email protected]",
message: "This is a test",
content: "New support request",
theme: {
title: "📩 RenderCard Support Message",
author: { name: "Anonymous User · 8f3a2d" },
color: 0x5865f2,
footer: { text: "Email: [email protected]" },
timestamp: new Date().toISOString(),
},
});Notes
- Package size (npm): ~9.4 kB compressed, ~65 kB unpacked (v1.0.0)
- Uses only
fetch,URL, and JSON - Retry once on 429 rate limits
- Best effort delivery
- This is for small developer notifications and internal workflows, not a guaranteed delivery system for enterprise products.
- Requires a Discord bot token with permission to post in the target channel.
Environment Variables
Optional, not required, but recommended to keep your token safe:
FORMCORD_DISCORD_TOKEN=xxxx
FORMCORD_DISCORD_CHANNEL=yyyyLicense
MIT
