On This Page

Invites and Webhooks

28 symbols from @neontechspace/fluxerly

Functions#

createWebhookClient#

Create a client that uses one webhook's token rather than bot authentication

Pass { id, token } or the credentials returned by a bot client's webhooks.create. Creation is synchronous, validates locally and makes no request. It copies the credential into a separate reference that hides the token when displayed. Reuse one client per credential to share its request limits and rate waits. The default instance is hosted Fluxer. A self-hosted instance can be selected explicitly. No token store or gateway is created. Always await shutdown when finished, or declare the client with await using as in the example. Invalid settings throw ConfigurationError. Unexpected creation failures throw SdkDefect. A throwing option getter or revealToken uses code application.defect with the thrown value as its cause

createWebhookClient(options: WebhookClientOptions): WebhookClientcreateWebhookClient(
  options: WebhookClientOptions
): WebhookClient

Parameters

import { createWebhookClient } from "@neontechspace/fluxerly"
export async function webhookExample(id, token) {
    await using webhook = createWebhookClient({ id, token })
    const message = await webhook.send({ content: "Deploying…" })
    return message.isErr() ? message : await webhook.editMessage(message.value.id, { content: "Deployed" })
}
import { createWebhookClient } from "@neontechspace/fluxerly"
export async function webhookExample(id: string, token: string) {
    await using webhook = createWebhookClient({ id, token })
    const message = await webhook.send({ content: "Deploying…" })
    return message.isErr() ? message : await webhook.editMessage(message.value.id, { content: "Deployed" })
}

Variables#

WebhookType#

Select a received webhook's shape by comparing its type with these constants

A future Fluxer kind arrives as UnknownWebhook with type "unknown" and its number in rawType

const WebhookType: Readonly<{ … }>
ChannelFollower#

A webhook created when a text channel follows an announcement channel

2
Incoming#

A webhook that accepts messages through its own secret token

1

Interfaces#

ChannelFollowerWebhook#

A webhook that delivers published messages from a followed announcement channel, selected by type === WebhookType.ChannelFollower

Manage it with a bot client's webhooks.edit and webhooks.delete. It can be renamed or moved to a text channel in the same community, but its avatar cannot be changed. Deleting it unfollows the source. It has no exposed token and cannot be used with createWebhookClient

interface ChannelFollowerWebhook extends WebhookBaseinterface ChannelFollowerWebhook
  extends WebhookBase
sourceChannel optional#

Followed channel while it exists and the original creator can view it

Absence does not prove deletion

WebhookSourceChannel
sourceGuild optional#

Source community while it exists and the original creator can view it

Absence does not prove deletion

WebhookSourceGuild

Inherited from WebhookBase: avatar, channelId, guildId, id, name

CreatedWebhook#

Result of creating a webhook, including the secret needed to use it without a bot token

interface CreatedWebhook
credentials#

Secret-bearing object for createWebhookClient

Closing a client does not erase this separate object

WebhookCredentials
webhook#

Frozen incoming webhook details, without the required token held separately in credentials

IncomingWebhook

Invite#

An invite link and the destination details Fluxer returned to this caller

These returned details are frozen (read-only). Fetching them does not accept the invite or change membership, and the SDK does not keep them. Codes can grant access to the destination and should only be shared with intended recipients. The reported counts and expiry do not guarantee that someone can join later

interface Invite
channel#

Minimal destination channel identity, not a full channel snapshot

id

Decimal destination channel ID, not the invitation code

string
name optional

Destination channel name

Null means no name, omission means Fluxer did not supply it

string | null
type

Numeric Fluxer channel type

This can describe a community channel or a private group conversation

number
code#

Provider code, not a full URL

The SDK never includes it in errors or diagnostics

string
expiresAt optional#

ISO 8601 expiry

Null means no expiry, omission means unavailable

string | null
guild optional#

Present for community invites only

Not a full guild snapshot

id

Decimal ID of the community this invitation leads to

string
name

Community name returned with this invitation

string
inviterId optional#

Creator ID

Null means no creator, omission means unavailable

string | null
memberCount#

Observed destination member count

number
presenceCount optional#

Observed presence count, available for community invites

number
temporary#

Whether Fluxer treats membership gained through this invite as temporary

boolean
type#

Community invite or invitation to an existing group DM

"group" | "guild"
url#

Invite URL built from the selected instance's discovered invite base and an encoded code, ready to share with intended recipients

Does not check expiry or joinability. Not a credential-safe value for diagnostics or public logs

string

InviteCreate#

Set how long an invite lasts, how many times it can be used and whether Fluxer may reuse an existing code

Creating an invite does not join the recipient or create the destination. Omission requests a new code with unlimited uses that expires after one day. Fluxer enforces destination access, invite permissions and capacity

interface InviteCreate
export function inviteExample(client, channelId) {
    return client.invites.create(channelId)
}
export function shareInviteExample(invite) {
    return { content: invite.url }
}
import type { Client } from "@neontechspace/fluxerly"
export function inviteExample(client: Client, channelId: string) {
    return client.invites.create(channelId)
}
export function shareInviteExample(invite: import("@neontechspace/fluxerly").Invite) {
    return { content: invite.url }
}
maxAgeSeconds optional#

Lifetime in seconds, integer 0–604800

Default 86400. Zero requests no expiry

number
maxUses optional#

Maximum uses, integer 0–100

Default zero means unlimited uses until expiry

number
temporary optional#

Default false

True requests temporary community membership, which Fluxer can remove after disconnect

boolean
unique optional#

Default true requests a new code

False permits Fluxer to reuse a matching existing invite

boolean

InviteMetadata#

Invite details returned by creation and management lists, including creation time and use limits

Use these observations to inspect or reconcile created codes, not to predict whether a future join succeeds. The SDK does not cache invite codes or track later uses

interface InviteMetadata extends Inviteinterface InviteMetadata
  extends Invite
createdAt#

ISO 8601 creation time

string
maxAgeSeconds optional#

Configured lifetime in seconds

Zero means no expiry. Fluxer omits this for group invites

number
maxUses#

Zero means unlimited uses until expiry

number
uses#

Observed uses, which may change immediately

number

Inherited from Invite: channel, code, expiresAt, guild, inviterId, memberCount, presenceCount, temporary, type, url

Invites#

Inspect, create, list and revoke invite codes with the bot's credentials

No gateway connection or invite cache is needed. Fluxer checks destination visibility, invite permissions and capacity. Shared guild request limits and deadlines apply. Eligible reads retry at most twice. Writes retry only confirmed HTTP 429 rejections

interface Invites

Expected failures return GuildOperationError or ClientClosedError. Abort returns CancelledError after cleanup. Unexpected failures reject with SdkDefect. A lost write response can leave the invite change applied. Check remote state before retrying

create#

Create an invite for an accessible channel, including an existing group direct message

Defaults are a new code, 86,400 seconds, unlimited uses and non-temporary membership. The result is invite metadata. The SDK does not send the code, create a group or add members. Cancellation cannot revoke an invite that was already created. After an unknown outcome, list the destination's invites before deciding whether to create again

create(
    channelId: string,
    input?: InviteCreate,
    options?: AuditedRequestOptions
): ResultAsync<
    InviteMetadata,
    ConfigurationError | GuildOperationFailure | CancelledError
>create(
  channelId: string,
  input?: InviteCreate,
  options?: AuditedRequestOptions
): ResultAsync<
  InviteMetadata,
  | ConfigurationError
  | GuildOperationFailure
  | CancelledError
>

Parameters

channelId
string
input optional
InviteCreate
options optional
AuditedRequestOptions

delete#

Revoke an invite code, succeeding with no value after HTTP 204

Fluxer checks creator or management permissions. Existing members remain. A missing code is an error, not proof a previous delete succeeded

delete(code: string, options?: AuditedRequestOptions): ResultAsync<
    void,
    ConfigurationError | GuildOperationFailure | CancelledError
>delete(
  code: string,
  options?: AuditedRequestOptions
): ResultAsync<
  void,
  | ConfigurationError
  | GuildOperationFailure
  | CancelledError
>

Parameters

code
string
options optional
AuditedRequestOptions

fetch#

Look up an invite code without using it or joining its destination

Pass the code, not its full URL. Expired, revoked or inaccessible codes fail remotely. Fluxer may normalize the case of a vanity code

fetch(code: string, options?: RequestOptions): ResultAsync<
    Invite,
    ConfigurationError | GuildOperationFailure | CancelledError
>fetch(
  code: string,
  options?: RequestOptions
): ResultAsync<
  Invite,
  | ConfigurationError
  | GuildOperationFailure
  | CancelledError
>

Parameters

code
string
options optional
RequestOptions

fetchForChannel#

List a channel's management-visible invites in Fluxer's order

Channel permissions determine access. Concurrent changes can make the list stale, so it is not a stable snapshot

fetchForChannel(
    channelId: string,
    options?: RequestOptions
): ResultAsync<
    readonly InviteMetadata[],
    ConfigurationError | GuildOperationFailure | CancelledError
>fetchForChannel(
  channelId: string,
  options?: RequestOptions
): ResultAsync<
  readonly InviteMetadata[],
  | ConfigurationError
  | GuildOperationFailure
  | CancelledError
>

Parameters

channelId
string
options optional
RequestOptions

fetchForGuild#

List a community's management-visible invites with ManageGuild permission

The community's vanity invite is excluded

fetchForGuild(
    guildId: string,
    options?: RequestOptions
): ResultAsync<
    readonly InviteMetadata[],
    ConfigurationError | GuildOperationFailure | CancelledError
>fetchForGuild(
  guildId: string,
  options?: RequestOptions
): ResultAsync<
  readonly InviteMetadata[],
  | ConfigurationError
  | GuildOperationFailure
  | CancelledError
>

Parameters

guildId
string
options optional
RequestOptions

UnknownWebhook#

A webhook kind this SDK version does not know, selected by type === "unknown"

Its rawType preserves Fluxer's number and any supplied source snapshots remain readable. No known WebhookType constant matches this shape, and no token credentials are inferred

interface UnknownWebhook
    extends WebhookBase, Omit<ChannelFollowerWebhook, "type">interface UnknownWebhook
  extends WebhookBase, Omit<
    ChannelFollowerWebhook,
    "type"
  >
rawType#

Numeric webhook kind Fluxer sent, outside the known WebhookType constants

number
type#

Always "unknown"

"unknown"

Inherited from WebhookBase: avatar, channelId, guildId, id, name

Inherited from ChannelFollowerWebhook: sourceChannel, sourceGuild

WebhookBase#

Identity, appearance and destination shared by every received webhook kind, without credentials

interface WebhookBase
avatar#

Identifier for the webhook's avatar image, not a complete URL

Null means no custom avatar

string | null
channelId#

ID of the channel that receives its messages, as last reported by Fluxer

string
guildId#

ID of the community that owns this webhook

string
id#

Webhook identifier, kept as a decimal string to avoid JavaScript number rounding

string
name#

Default sender name shown on webhook messages

string
type#

A WebhookType constant, or "unknown" for a kind this SDK version does not know

Compare it to select the matching shape

"unknown" | 2 | 1

WebhookClient#

Send and manage messages with one incoming webhook's token, without a bot token or gateway

Follower webhooks have no exposed token and Fluxer rejects their token-authenticated operations with UNKNOWN_WEBHOOK. Create this with createWebhookClient and always await shutdown when finished

interface WebhookClient extends AsyncDisposableinterface WebhookClient
  extends AsyncDisposable

No cache or persistent token store is created, and other clients' caches are not updated. Calls start immediately and return ResultAsync for expected successes and failures. The default 30,000 ms total deadline includes capacity, rate-limit, retry and HTTP waits. Confirmed HTTP 429 responses use this client's shared rate-limit state as described on Client. Abort cancels only the operation and waits for request and body cleanup, without reversing remote changes. Errors include safe categories and status, not token-bearing paths or response bodies. Successful JSON is capped at 16 MiB before parsing, not total memory. A failed response after sending a write leaves an uncertain result and is not retried automatically. Unexpected SDK or cleanup failures reject with SdkDefect. Cleanup failure stops retries and keeps safe details of any accompanying operation failure or cancellation

id#

The webhook's decimal ID, without its token or a token-bearing URL

string
instance#

Resolve this webhook client's selected instance and get pure URL helpers for it

Instance

[asyncDispose]#

Shut down this client and wait for cleanup, as await using does at the end of a block

Unexpected cleanup failures reject with SdkDefect, as shutdown does

[asyncDispose](): Promise<void>
Returns
Promise<void>

delete#

Delete this webhook remotely using its token, succeeding after HTTP 204

This does not close the client or release its local credential reference. Later requests normally fail with notFound because the token was revoked. Call shutdown separately to release the client's local resources

delete(options?: RequestOptions): ResultAsync<
    void,
    ConfigurationError | WebhookOperationFailure | CancelledError
>delete(
  options?: RequestOptions
): ResultAsync<
  void,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

options optional
RequestOptions

deleteMessage#

Delete this webhook's message, succeeding with no value after HTTP 204

For a message in a thread, including a forum post, set options.threadId to the thread's ID. Success does not prove the message previously existed. A failure with an unknown outcome can leave the message deleted

deleteMessage(
    messageId: string,
    options?: WebhookMessageOperationOptions
): ResultAsync<
    void,
    ConfigurationError | WebhookOperationFailure | CancelledError
>deleteMessage(
  messageId: string,
  options?:
    WebhookMessageOperationOptions
): ResultAsync<
  void,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

messageId
string

edit#

Change this webhook's name or avatar using its token and return metadata without credentials

To move it to another channel, use a bot client's webhooks.edit. A failed or cancelled write can still have applied. This method does not close the client

edit(
    input: WebhookTokenEdit,
    options?: RequestOptions
): ResultAsync<
    IncomingWebhook,
    ConfigurationError | WebhookOperationFailure | CancelledError
>edit(
  input: WebhookTokenEdit,
  options?: RequestOptions
): ResultAsync<
  IncomingWebhook,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

options optional
RequestOptions

editMessage#

Change this webhook's message and return its updated snapshot

A plain string replaces only the text, as shorthand for { content }. Omitted fields stay unchanged. Mentions default off and attachments cannot be replaced. A flags-only edit replaces only MessageFlags.SuppressEmbeds and MessageFlags.SuppressNotifications, and 0 clears them. Crossposted, IsCrosspost and SourceMessageDeleted are server-managed. Those bits and VoiceMessage fail locally before dispatch. Embed input cannot resolve existing file references. For a message in a thread, including a forum post, set options.threadId to the thread's ID

editMessage(
    messageId: string,
    input: string | WebhookMessageEdit,
    options?: WebhookMessageOperationOptions
): ResultAsync<
    Message,
    ConfigurationError | WebhookOperationFailure | CancelledError
>editMessage(
  messageId: string,
  input:
    | string | WebhookMessageEdit,
  options?:
    WebhookMessageOperationOptions
): ResultAsync<
  Message,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

messageId
string
input
string | WebhookMessageEdit

fetch#

Fetch this incoming webhook's current metadata using its token, not bot authentication

Creator and private fields are not retained

fetch(options?: RequestOptions): ResultAsync<
    IncomingWebhook,
    ConfigurationError | WebhookOperationFailure | CancelledError
>fetch(
  options?: RequestOptions
): ResultAsync<
  IncomingWebhook,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

options optional
RequestOptions

fetchMessage#

Fetch a message authored by this webhook in its current channel, using a decimal message ID

For a message in a thread, including a forum post, set options.threadId to the thread's ID. Eligible transient read failures have bounded retries

fetchMessage(
    messageId: string,
    options?: WebhookMessageOperationOptions
): ResultAsync<
    Message,
    ConfigurationError | WebhookOperationFailure | CancelledError
>fetchMessage(
  messageId: string,
  options?:
    WebhookMessageOperationOptions
): ResultAsync<
  Message,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

messageId
string

send#

Send a webhook message and return the created message after Fluxer's HTTP response

A plain string sends only that text, as shorthand for { content }. The SDK uses wait=true, and mentions are disabled by default. A supplied nonce requests best-effort duplicate suppression for five minutes, not exactly-once delivery. Without a nonce, none is sent unless a forward source supplies one, and a nonce on both the message and its forward source fails before dispatch. Reply references can include files. Forward references preserve only the source snapshot and reject new content or uploads

send(
    input: string | WebhookMessageInput,
    options?: RequestOptions
): ResultAsync<
    Message,
    ConfigurationError | WebhookOperationFailure | CancelledError
>send(
  input:
    | string | WebhookMessageInput,
  options?: RequestOptions
): ResultAsync<
  Message,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Set threadId to post into an existing thread. In a forum or media channel, set threadName, with optional appliedTagIds, to start a new post instead. The result is then the post's first message, whose channelId is the new post's ID. See WebhookMessageInput for the rules that the SDK checks before dispatch

Each attachment supplies data bytes, a sized Blob or File source, or a finite stream with its exact size. Metadata and data bytes are copied when execution starts, before waiting. File and stream sources are read when the multipart upload begins, without copying or spooling. Keep file data stable, and supply a fresh stream for each operation because a stream is consumed at most once and must deliver exactly its declared size. Cleanup cancels unfinished readers and awaits lock release, without closing caller paths or FileHandles. Multipart file uploads are streamed with a maximum of 50 MiB per file and share the configured upload-byte budget. An attachment:// image or thumbnail URL must match one new upload whose filename maps to an image or video MIME type. The flags input accepts only MessageFlags.SuppressEmbeds and MessageFlags.SuppressNotifications. Crossposted, IsCrosspost and SourceMessageDeleted are server-managed. Those bits and VoiceMessage fail locally before dispatch

A failure with an unknown outcome can leave the message posted and is never replayed automatically. A confirmed inline HTTP 429 can replay copied data bytes, but file and stream inputs fail with rateLimit without being reopened or reread

Parameters

input
string | WebhookMessageInput
options optional
RequestOptions

shutdown#

Permanently stop this local client, reject new work, cancel active work and await transport cleanup

The client's token reference is released, but the remote webhook and caller-held credentials remain. Concurrent calls wait for the same pending cleanup. No expected failure is returned

shutdown(): ResultAsync<void, never>
Returns
ResultAsync<void, never>

Unexpected cleanup failures reject with SdkDefect

WebhookCreate#

Settings for a webhook that will post messages to the channel selected in the create call

Fields are sampled once when create starts, then validated and encoded from that snapshot

interface WebhookCreate
avatar optional#

Base64 image data URI, or null for the default avatar

Fluxer validates image format and size

string | null
name#

Default sender name, 1–80 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming

The original string is sent unchanged

string

WebhookCredentials#

The secret returned when an incoming webhook is created, kept separate from its public details

Pass this object to createWebhookClient, or call revealToken to save the secret in the application's own secure storage. The SDK does not save the token to disk. Anyone with the ID and token can use this webhook's token-authenticated operations

interface WebhookCredentials
id#

ID of the webhook this secret belongs to

string

revealToken#

Return the token as plain text for secure storage or transfer

Never log the returned string

revealToken(): string
Returns
string

WebhookEdit#

Changes to an existing webhook made through a bot client's webhooks.edit operation

Supply at least one setting. Omitted settings stay unchanged. Moving the destination channel requires bot authentication and cannot be done by a token-only webhook client. Follower webhooks can be renamed or moved, but Fluxer rejects an avatar change with field avatar and code INVALID_FORMAT. A move emits Webhooks Update for the old and new channel. The SDK does not synthesize those events. Fields are sampled once when edit starts, then validated and encoded from that snapshot

interface WebhookEdit
avatar optional#

Base64 image data URI, or null to remove the avatar

Follower webhooks reject any supplied avatar change

string | null
channelId optional#

Move future messages within the same community, subject to Fluxer's permissions

Followers require a text channel, while incoming webhooks allow text, voice or announcement channels

string
name optional#

New default sender name, 1–80 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming

The original string is sent unchanged

string

WebhookForumPostOptions#

Settings for starting a new post in a forum or media channel through a webhook

The webhook must belong to that forum or media channel, and Fluxer rejects threadName for any other channel. Set them only on a new message, not on a reply or forward

interface WebhookForumPostOptions
appliedTagIds optional#

IDs of the tags to apply to the new post, at most 5

This needs threadName. Fluxer rejects an ID that the channel does not have, a moderated tag because a webhook cannot manage threads, and a post with no tag when the channel has ChannelFlags.RequireTag

readonly string[]
threadName optional#

Name of the new post, 1–100 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming

The original string is sent unchanged. The message becomes the first message of the new post, and the result is that message, whose channelId is the new post's ID. Fluxer needs this or threadId to place a message in a forum or media channel, and it cannot be combined with threadId

string

WebhookForwardReference#

Ask Fluxer to copy an existing message into a forwarded webhook message in the same channel

interface WebhookForwardReference
source#

Source message and optional attachment/embed selections

Fluxer copies the message without a separate SDK fetch. A source nonce is used only when the message has no top-level nonce. Supplying both fails locally, even if equal

ForwardMessageInput
type#

Select forwarding rather than a reply with newly written content

"forward"

WebhookMessageEdit#

Changes to a message previously sent by this webhook

Supply content, embeds or flags. Omitted values stay unchanged, while empty text or an empty embed array clears that part. This operation cannot upload or replace attachments

interface WebhookMessageEdit
allowedMentions optional#

Which mentions in the edited message may notify people

Notifications are disabled by default for this edit

AllowedMentions
content optional#

New message text, or an empty string to remove the existing text

string
embeds optional#

New rich-message cards as plain objects or EmbedBuilder instances, or an empty array to remove the existing embeds

readonly (EmbedInput | EmbedBuilder)[]
flags optional#

Replace only MessageFlags.SuppressEmbeds and MessageFlags.SuppressNotifications

Omit to preserve them, or use zero to clear both. Crossposted, IsCrosspost and SourceMessageDeleted are server-managed. Those bits and VoiceMessage fail locally before dispatch

number

WebhookReplyReference#

Attach a webhook message as a reply to an existing message in the webhook's destination channel

interface WebhookReplyReference
target#

Message ID and channel ID to reply to

Fluxer checks that the message exists, is replyable and is in the destination channel

MessageReference
type#

Select reply behavior rather than copying a message as a forward

"reply"

WebhookSourceChannel#

A frozen snapshot of a followed announcement channel

Fluxer supplies it only while the source exists and the webhook's original creator can view it. Missing source metadata does not prove the source was deleted

interface WebhookSourceChannel
id#

Decimal ID of the followed announcement channel

string
name#

Source channel name when Fluxer returned this snapshot

string

WebhookSourceGuild#

A frozen snapshot of the community that owns a followed announcement channel

Fluxer supplies it only while the source exists and the webhook's original creator can view it. Missing source metadata does not prove the source was deleted

interface WebhookSourceGuild
icon optional#

Community icon hash, not a complete URL

Null means no icon, and omission means unavailable

string | null
id#

Decimal ID of the source community

string
name#

Source community name when Fluxer returned this snapshot

string

WebhookTokenEdit#

Change an incoming webhook's default name or avatar through its token-only client

Supply at least one setting. Omitted settings stay unchanged, and moving channels requires a bot client instead. Fields are sampled once when edit starts, then validated and encoded from that snapshot

interface WebhookTokenEdit
avatar optional#

Base64 image data URI, or null to remove the avatar

string | null
name optional#

New default sender name, 1–80 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming

The original string is sent unchanged

string

Webhooks#

Manage webhooks with this bot's credentials, without connecting the gateway

Use createWebhookClient for a separate client that sends using a webhook's own token. Metadata excludes tokens. There is no webhook cache or hidden credential storage. The default total deadline, rest.defaultTimeoutMs (30,000 ms unless configured), includes capacity, rate-limit and retry waits. Eligible reads have bounded retries. Writes retry only confirmed rate-limit rejection. Success JSON is limited to 16 MiB before parsing, not total memory. Malformed or larger successes return reason response. After dispatch, a failed response can leave the write applied and is not retried automatically. Abort returns CancelledError after cleanup. Unexpected failures reject with SdkDefect. Client shutdown rejects new work and waits for active request cleanup. Separate clients do not coordinate rate limits

interface Webhooks

create#

Create an incoming webhook in a text, voice or announcement channel using the bot's permissions

The result separates metadata from redacted credentials, which expose the token only through revealToken. Credentials passed to createWebhookClient must remain private. An unknown outcome may have left the webhook created

create(
    channelId: string,
    input: WebhookCreate,
    options?: AuditedRequestOptions
): ResultAsync<
    CreatedWebhook,
    ConfigurationError | WebhookOperationFailure | CancelledError
>create(
  channelId: string,
  input: WebhookCreate,
  options?: AuditedRequestOptions
): ResultAsync<
  CreatedWebhook,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

channelId
string
options optional
AuditedRequestOptions

delete#

Delete an incoming webhook and revoke its credential, or delete a follower webhook to unfollow its source

Existing webhook messages remain. Fluxer emits Webhooks Update for the destination channel. The SDK does not synthesize that event. A failure does not restore a deleted follow or revoked credential

delete(id: string, options?: AuditedRequestOptions): ResultAsync<
    void,
    ConfigurationError | WebhookOperationFailure | CancelledError
>delete(
  id: string,
  options?: AuditedRequestOptions
): ResultAsync<
  void,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

id
string
options optional
AuditedRequestOptions

edit#

Change the supplied incoming or follower webhook settings, including its destination channel

Followers can be renamed or moved to a text channel in the same community, but an avatar change fails with field avatar and Fluxer code INVALID_FORMAT. Incoming webhooks allow text, voice or announcement destinations. Moving emits Webhooks Update for the old and new channel. The SDK does not synthesize those events. Returned metadata excludes credentials. A failed response does not guarantee the changes were rolled back

edit(
    id: string,
    input: WebhookEdit,
    options?: AuditedRequestOptions
): ResultAsync<
    Webhook,
    ConfigurationError | WebhookOperationFailure | CancelledError
>edit(
  id: string,
  input: WebhookEdit,
  options?: AuditedRequestOptions
): ResultAsync<
  Webhook,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

id
string
options optional
AuditedRequestOptions

fetch#

Fetch incoming, follower or unknown-kind metadata by decimal ID, discarding any returned token

Follower sources are present only while they exist and the original creator can view them. Missing source metadata does not prove deletion. A missing webhook fails with reason notFound

fetch(id: string, options?: AuditedRequestOptions): ResultAsync<
    Webhook,
    ConfigurationError | WebhookOperationFailure | CancelledError
>fetch(
  id: string,
  options?: AuditedRequestOptions
): ResultAsync<
  Webhook,
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

id
string
options optional
AuditedRequestOptions

fetchForChannel#

List the channel's accessible incoming, follower and unknown-kind webhook metadata without pagination

No tokens are retained and no webhook cache is filled

fetchForChannel(
    channelId: string,
    options?: AuditedRequestOptions
): ResultAsync<
    readonly Webhook[],
    ConfigurationError | WebhookOperationFailure | CancelledError
>fetchForChannel(
  channelId: string,
  options?: AuditedRequestOptions
): ResultAsync<
  readonly Webhook[],
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

channelId
string
options optional
AuditedRequestOptions

fetchForGuild#

List the community's accessible incoming, follower and unknown-kind webhook metadata

Fluxer permissions determine visibility. Concurrent changes mean this is not a stable snapshot

fetchForGuild(
    guildId: string,
    options?: AuditedRequestOptions
): ResultAsync<
    readonly Webhook[],
    ConfigurationError | WebhookOperationFailure | CancelledError
>fetchForGuild(
  guildId: string,
  options?: AuditedRequestOptions
): ResultAsync<
  readonly Webhook[],
  | ConfigurationError
  | WebhookOperationFailure
  | CancelledError
>

Parameters

guildId
string
options optional
AuditedRequestOptions

Type Aliases#

WebhookClientOptions#

Credentials and limits for createWebhookClient

Supply an incoming webhook's ID/token pair from secure storage or the credentials object returned by webhook creation. Follower webhooks expose no token and cannot be executed by a webhook client. Creating the client validates and copies these values locally. It does not send a request or prove the credentials work

type WebhookClientOptions =
    & (
          | { readonly id: string; readonly token: string }
          | WebhookCredentials)
    & {
          readonly instance?: InstanceOptions
          readonly logging?: LoggingOptions
          readonly uploadMaxBytes?: number
      }type WebhookClientOptions =
    & (
        | {
            readonly id: string
            readonly token: string
          }
        | WebhookCredentials)
    & {
        readonly instance?:
          InstanceOptions
        readonly logging?:
          LoggingOptions
        readonly uploadMaxBytes?:
          number
      }

WebhookMessageInput#

A message to send through a webhook client, using the webhook's token rather than a bot token

For a new message, supply text, embeds, uploads or stickers and omit messageReference. For a reply, add a reply reference and write the content or attachments normally. For a forward, supply only a forward reference and optional nonce, sender, flags or mention overrides. Forwards cannot also contain new text, embeds, stickers or uploads. Fluxer rejects missing or cross-channel reply/forward targets. New messages do not require the destination channel ID. Fluxer never sends a webhook message as text-to-speech, so a tts property fails with reason input before dispatch, like any other unknown property

type WebhookMessageInput =
    | MessageBody
      & WebhookMessageOptions
      & WebhookForumPostOptions
      & { readonly messageReference?: WebhookReplyReference }
    | WebhookMessageOptions
      & { readonly messageReference: WebhookForwardReference }type WebhookMessageInput =
    | MessageBody
      & WebhookMessageOptions
      & WebhookForumPostOptions
      & {
          readonly messageReference?:
            WebhookReplyReference
        }
    | WebhookMessageOptions
      & {
          readonly messageReference:
            WebhookForwardReference
        }

To post into a thread, set threadId. To start a new post in a forum or media channel, set threadName and optionally appliedTagIds on a new message. A webhook in a forum or media channel needs one of threadId and threadName, and the SDK rejects a message that sets both. A reply or forward cannot start a post, because the new post holds no message to refer to, so threadName with a messageReference fails before dispatch

WebhookMessageOptions#

Delivery settings shared by new, reply and forward webhook messages

type WebhookMessageOptions = { … }
allowedMentions optional#

Which mentions may notify people

By default, mention text does not enable notifications

AllowedMentions
avatarUrl optional#

Override the avatar for this message only

Use an HTTP(S) URL without credentials, at most 8,192 characters, fetched by Fluxer

string
flags optional#

Message behavior flags from MessageFlags

Only SuppressEmbeds and SuppressNotifications are writable, and omission uses Fluxer's default. Crossposted, IsCrosspost and SourceMessageDeleted are server-managed. Those bits and VoiceMessage fail locally before dispatch

number
nonce optional#

Application-chosen correlation nonce, a string of 1–32 UTF-16 code units or a nonnegative safe integer encoded as a decimal string

Omission sends no nonce, unless the forward source supplies one. Supplying both locations fails locally. For five minutes after saving a message, Fluxer tries to suppress another send through this webhook with the same nonce. This does not guarantee exactly-once delivery

MessageNonce
threadId optional#

Decimal ID of a thread in the webhook's channel, sent as the thread_id query parameter so the message goes to that thread instead of the channel

Fluxer rejects a thread that belongs to another channel, and a forum or media channel needs either this or threadName. It cannot be combined with threadName

string
username optional#

Override the sender name for this message only, using 1–80 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming

The original string is sent unchanged

string