Docs
Formcord
Universal Discord notifications with zero dependencies. Works in Edge, serverless, and Node runtimes using only Web APIs.
Get started
Install
bash
npm install formcordEnvironment variables
ENV
FORMCORD_DISCORD_TOKEN=xxxx
FORMCORD_DISCORD_CHANNEL=yyyyFirst message
TS
import { formcord } from "formcord";
await formcord.contact({
token: process.env.FORMCORD_DISCORD_TOKEN!,
channelId: process.env.FORMCORD_DISCORD_CHANNEL!,
subject: "Hello",
email: "me@example.com",
message: "This is a test",
});Discord bot setup (quick and easy)
- 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).
Helpers
Five helpers for common notification patterns.
contact
Form submissions and inquiries.
- subject - Subject of the contact message
- email - Sender email address
- message - Message body
- content - Optional top message
- theme - Optional embed theming
TS
formcord.contact({
token,
channelId,
subject,
email,
message,
throwOnError,
content,
theme,
});error
Runtime errors with optional context.
- error - Error object or message
- source - Where the error originated
- environment - Runtime environment
- content - Optional top message
- theme - Optional embed theming
TS
formcord.error({
token,
channelId,
error,
source,
environment,
throwOnError,
content,
theme,
});deploy
Deployment notifications.
- project - Project name
- environment - Environment name
- url - Deployment URL
- commit - Commit SHA or ref
- content - Optional top message
- theme - Optional embed theming
TS
formcord.deploy({
token,
channelId,
project,
environment,
url,
commit,
throwOnError,
content,
theme,
});feedback
User feedback and ratings.
- rating - Rating value
- message - Feedback text
- content - Optional top message
- theme - Optional embed theming
TS
formcord.feedback({
token,
channelId,
rating,
message,
throwOnError,
content,
theme,
});bug
Bug reports with steps and context.
- title - Bug title
- steps - Steps to reproduce
- browser - Browser or client info
- content - Optional top message
- theme - Optional embed theming
TS
formcord.bug({
token,
channelId,
title,
steps,
browser,
throwOnError,
content,
theme,
});Theming and content
Add a top message with content and customize embeds with theme.
TS
formcord.contact({
token,
channelId,
subject: "Hello",
email: "me@example.com",
message: "This is a test",
content: "New support request",
theme: {
title: "RenderCard Support Message",
author: { name: "Anonymous User - 8f3a2d" },
color: 0x5865f2,
footer: { text: "Email: me@example.com" },
timestamp: new Date().toISOString(),
},
});Notes
- Uses only
fetch,URL, and JSON. - Retries once on 429 rate limits.
- Best effort delivery.
- Requires a Discord bot token with permission to post.
- Not a guaranteed delivery system for enterprise logging or auditing.