Skip to content

Discord

Protocol
discord:
Runtime
Node.jsBrowser
Official documentation
discord://<webhook-id>:<webhook-token>@webhook
import { send } from 'statocysts'
await send(
'discord://123456789012345678:WEBHOOK_TOKEN@webhook',
{ title: 'Deployment complete', body: 'Production is healthy.' },
)

The webhook ID is URL username and the token is URL password.

Parameter Description
username Override the webhook display name.
avatar_url Override the webhook avatar URL.
wait Add wait=true to Discord’s request when truthy. false, 0, and an empty value are false.
discord://123456789012345678:WEBHOOK_TOKEN@webhook?username=Operations&wait=true

A title-only notification becomes plain content. With a body, the content is formatted as a Markdown level-two heading followed by the body.

Direct discord.send() calls accept fetchOptions:

import { discord } from 'statocysts'
await discord.send(target, notification, {
fetchOptions: { timeout: 5000 },
})