On This Page

Invites and Webhooks

28 symbols from @neontechspace/fluxerly/effect

Functions#

createWebhookClient#

Create a webhook-only client for hosted Fluxer or an explicitly selected self-hosted instance, from { id, token } or redacted creation credentials

Validate the inputs locally without requests. The client copies the credential into its own redacted reference. Creation starts when the Effect executes. Closing its Scope shuts down the client. The Effect Clock available when creation executes owns this client's request queue and deadlines. Providing a different Clock around a later operation does not replace that owner Clock. The SDK does not persist the token, connect a gateway or authenticate as a bot. Reuse one client per credential to share request slots, queue limits and rate-limit waits. Invalid configuration is misuse and dies with ConfigurationError, and other defects retain their Cause

createWebhookClient(
    options: WebhookClientOptions
): Effect<WebhookClient, never, Scope>createWebhookClient(
  options: WebhookClientOptions
): Effect<
  WebhookClient, never, Scope
>

Parameters

Returns
Effect<WebhookClient, never, Scope>
TypeScript
import { Effect } from "effect"
import { createWebhookClient } from "@neontechspace/fluxerly/effect"
export const webhookExample = (id: string, token: string) => Effect.scoped(Effect.gen(function* () {
    const webhook = yield* createWebhookClient({ id, token })
    const message = yield* webhook.send({ content: "Deploying…" })
    return yield* webhook.editMessage(message.id, { content: "Deployed" })
}))

Interfaces#

Invites#

Inspect, create, list or revoke invite codes without joining their destinations

Methods return Effects and do not connect the gateway or cache invites. Reads retry eligible transient failures at most twice. Writes retry only confirmed 429 rejections. Fluxer checks destination visibility, invite permissions and capacity. Failures use GuildOperationError. Effects start when executed. Interruption waits for owned cleanup and defects remain in Cause. Closing clients fail with ClientClosedError. Lost responses can leave mutations applied. Do not replay them blindly

interface Invites

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
): Effect<InviteMetadata, GuildOperationFailure>create(
  channelId: string,
  input?: InviteCreate,
  options?: AuditedRequestOptions
): Effect<
  InviteMetadata,
  GuildOperationFailure
>

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
): Effect<void, GuildOperationFailure>delete(
  code: string,
  options?: AuditedRequestOptions
): Effect<
  void,
  GuildOperationFailure
>

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
): Effect<Invite, GuildOperationFailure>fetch(
  code: string,
  options?: RequestOptions
): Effect<
  Invite,
  GuildOperationFailure
>

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
): Effect<readonly InviteMetadata[], GuildOperationFailure>fetchForChannel(
  channelId: string,
  options?: RequestOptions
): Effect<
  readonly InviteMetadata[],
  GuildOperationFailure
>

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
): Effect<readonly InviteMetadata[], GuildOperationFailure>fetchForGuild(
  guildId: string,
  options?: RequestOptions
): Effect<
  readonly InviteMetadata[],
  GuildOperationFailure
>

Parameters

guildId
string
options optional
RequestOptions

WebhookClient#

Send and manage one incoming webhook's messages using its webhook token

Follower webhooks have no exposed token and Fluxer rejects their token-authenticated operations with UNKNOWN_WEBHOOK. This client does not use a bot token, connect the gateway, cache resources or store tokens persistently

interface WebhookClient

Operations start when executed and preserve unexpected faults/interruption. Cleanup defects stop retries and preserve any operation failure or interruption alongside the defect in Cause

Requests default to a 30-second total deadline across queue waits, rate-limit waits, retries and HTTP. Confirmed HTTP 429 responses use this client's shared rate-limit state as described on Client. Cancellation interrupts only that operation and awaits request/body cleanup, without rolling back remote effects

Errors contain only safe categories and status, never credential-bearing paths or upstream bodies

Successful JSON bodies are capped at 16 MiB of response-body bytes before parsing, not total heap usage. Oversized successes fail with reason response. A response failure after a mutation request was sent leaves an unknown outcome and never retries automatically

Other client caches are not updated by this token-only client

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

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
): Effect<void, WebhookOperationFailure>delete(
  options?: RequestOptions
): Effect<
  void,
  WebhookOperationFailure
>

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
): Effect<void, WebhookOperationFailure>deleteMessage(
  messageId: string,
  options?:
    WebhookMessageOperationOptions
): Effect<
  void,
  WebhookOperationFailure
>

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
): Effect<IncomingWebhook, WebhookOperationFailure>edit(
  input: WebhookTokenEdit,
  options?: RequestOptions
): Effect<
  IncomingWebhook,
  WebhookOperationFailure
>

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
): Effect<Message, WebhookOperationFailure>editMessage(
  messageId: string,
  input:
    | string | WebhookMessageEdit,
  options?:
    WebhookMessageOperationOptions
): Effect<
  Message,
  WebhookOperationFailure
>

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
): Effect<IncomingWebhook, WebhookOperationFailure>fetch(
  options?: RequestOptions
): Effect<
  IncomingWebhook,
  WebhookOperationFailure
>

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
): Effect<Message, WebhookOperationFailure>fetchMessage(
  messageId: string,
  options?:
    WebhookMessageOperationOptions
): Effect<
  Message,
  WebhookOperationFailure
>

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
): Effect<Message, WebhookOperationFailure>send(
  input:
    | string | WebhookMessageInput,
  options?: RequestOptions
): Effect<
  Message,
  WebhookOperationFailure
>

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(): Effect<void>
Returns
Effect<void>

Cleanup defects remain in the Cause

Webhooks#

Create and manage webhooks with the bot token, without a gateway connection

There is no webhook cache or hidden credential persistence, and no events are synthesized. Successful JSON responses are limited to 16 MiB before parsing. This is not a total memory limit. Malformed or larger responses fail with reason response. If a response fails after a write was sent, the write may still have applied. The SDK does not retry it automatically. Each Effect starts when executed, with Effect interruption and defects. The default total deadline, rest.defaultTimeoutMs (30,000 ms unless configured), includes capacity, rate-limit and retry waits. Reads have bounded retries, and writes retry only after a confirmed rate-limit rejection. Shutdown rejects new work and awaits accepted 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
): Effect<CreatedWebhook, WebhookOperationFailure>create(
  channelId: string,
  input: WebhookCreate,
  options?: AuditedRequestOptions
): Effect<
  CreatedWebhook,
  WebhookOperationFailure
>

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
): Effect<void, WebhookOperationFailure>delete(
  id: string,
  options?: AuditedRequestOptions
): Effect<
  void,
  WebhookOperationFailure
>

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
): Effect<Webhook, WebhookOperationFailure>edit(
  id: string,
  input: WebhookEdit,
  options?: AuditedRequestOptions
): Effect<
  Webhook,
  WebhookOperationFailure
>

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
): Effect<Webhook, WebhookOperationFailure>fetch(
  id: string,
  options?: AuditedRequestOptions
): Effect<
  Webhook,
  WebhookOperationFailure
>

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
): Effect<readonly Webhook[], WebhookOperationFailure>fetchForChannel(
  channelId: string,
  options?: AuditedRequestOptions
): Effect<
  readonly Webhook[],
  WebhookOperationFailure
>

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
): Effect<readonly Webhook[], WebhookOperationFailure>fetchForGuild(
  guildId: string,
  options?: AuditedRequestOptions
): Effect<
  readonly Webhook[],
  WebhookOperationFailure
>

Parameters

guildId
string
options optional
AuditedRequestOptions

Re-Exports#

Declared in JavaScript & TypeScript and documented there. Import them from @neontechspace/fluxerly/effect as well

WebhookType#
Select a received webhook's shape by comparing its type with these constants
ChannelFollowerWebhook#
A webhook that delivers published messages from a followed announcement channel, selected by type === WebhookType.ChannelFollower
CreatedWebhook#
Result of creating a webhook, including the secret needed to use it without a bot token
IncomingWebhook#
A webhook that accepts token-authenticated operations, selected by type === WebhookType.Incoming
Invite#
An invite link and the destination details Fluxer returned to this caller
InviteCreate#
Set how long an invite lasts, how many times it can be used and whether Fluxer may reuse an existing code
InviteMetadata#
Invite details returned by creation and management lists, including creation time and use limits
UnknownWebhook#
A webhook kind this SDK version does not know, selected by type === "unknown"
WebhookBase#
Identity, appearance and destination shared by every received webhook kind, without credentials
WebhookCreate#
Settings for a webhook that will post messages to the channel selected in the create call
WebhookCredentials#
The secret returned when an incoming webhook is created, kept separate from its public details
WebhookEdit#
Changes to an existing webhook made through a bot client's webhooks.edit operation
WebhookForumPostOptions#
Settings for starting a new post in a forum or media channel through a webhook
WebhookForwardReference#
Ask Fluxer to copy an existing message into a forwarded webhook message in the same channel
WebhookMessageEdit#
Changes to a message previously sent by this webhook
WebhookReplyReference#
Attach a webhook message as a reply to an existing message in the webhook's destination channel
WebhookSourceChannel#
A frozen snapshot of a followed announcement channel
WebhookSourceGuild#
A frozen snapshot of the community that owns a followed announcement channel
WebhookTokenEdit#
Change an incoming webhook's default name or avatar through its token-only client
Webhook#
A frozen snapshot of a webhook's kind, appearance and destination when Fluxer last returned it
WebhookClientOptions#
Credentials and limits for createWebhookClient
WebhookMessageInput#
A message to send through a webhook client, using the webhook's token rather than a bot token
WebhookMessageOptions#
Delivery settings shared by new, reply and forward webhook messages
WebhookMessageReference#
Choose a reply with new content or a forward copied from an existing message when calling webhook.send