Table of Contents

Class IncomingWebhook

Namespace
NetCord.Rest
Assembly
NetCord.dll

Represents a newly-created webhook, containing its token and standard fields.

public class IncomingWebhook : Webhook, IEntity, ISpanFormattable, IFormattable, IEquatable<Entity>, IJsonModel<JsonWebhook>
Inheritance
IncomingWebhook
Implements
Inherited Members

Constructors

IncomingWebhook(JsonWebhook, RestClient)

Represents a newly-created webhook, containing its token and standard fields.

public IncomingWebhook(JsonWebhook jsonModel, RestClient client)

Parameters

jsonModel JsonWebhook
client RestClient

Properties

Token

The token of the newly created webhook.

public string Token { get; }

Property Value

string

Methods

DeleteMessageAsync(ulong, ulong?, RestRequestProperties?, CancellationToken)

Deletes a previously-sent webhook message permanently.

public Task DeleteMessageAsync(ulong messageId, ulong? threadId = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

messageId ulong

The ID of the message to delete.

threadId ulong?

The ID of the thread the message is in.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

DeleteWithTokenAsync(RestRequestProperties?, CancellationToken)

Deletes a webhook permanently, using the specified token.

public Task DeleteWithTokenAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

Remarks

Requires the ManageWebhooks permission, and fires a WebhooksUpdate event.

ExecuteAsync(WebhookMessageProperties, bool, ulong?, bool, RestRequestProperties?, CancellationToken)

Executes a webhook with the given parameters, optionally returning the message result.

public Task<RestMessage?> ExecuteAsync(WebhookMessageProperties message, bool wait = false, ulong? threadId = null, bool withComponents = true, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

message WebhookMessageProperties

The message to send through the webhook.

wait bool

If set, the returned RestMessage will contain the sent message, otherwise null.

threadId ulong?

Optional ID of the thread to send the message in, within the webhook's target channel. Can be null.

withComponents bool

Whether to respect the message's Components.

When enabled, allows application-owned webhooks to use all components, and non-owned webhooks to use non-interactive components.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<RestMessage>

GetAsync(RestRequestProperties?, CancellationToken)

Retrieves a Webhook object for the given ID.

public Task<IncomingWebhook> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IncomingWebhook>

GetMessageAsync(ulong, ulong?, RestRequestProperties?, CancellationToken)

Returns a previously-sent webhook message.

public Task<RestMessage> GetMessageAsync(ulong messageId, ulong? threadId = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

messageId ulong

The ID of the message to retrieve.

threadId ulong?

The ID of the thread the message is in.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<RestMessage>

GetWithTokenAsync(RestRequestProperties?, CancellationToken)

Retrieves a Webhook object for the given ID, using the specified webhook token.

public Task<IncomingWebhook> GetWithTokenAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IncomingWebhook>

Remarks

This endpoint does not require authentication.

ModifyAsync(Action<WebhookOptions>, RestRequestProperties?, CancellationToken)

Modifies a webhook, returning the updated Webhook object on success.

public Task<IncomingWebhook> ModifyAsync(Action<WebhookOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

action Action<WebhookOptions>

The modification to perform on the webhook.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IncomingWebhook>

Remarks

Requires the ManageWebhooks permission, and fires a WebhooksUpdate event.

ModifyMessageAsync(ulong, Action<MessageOptions>, ulong?, bool, RestRequestProperties?, CancellationToken)

Modifies a previously-sent webhook message.

public Task<RestMessage> ModifyMessageAsync(ulong messageId, Action<MessageOptions> action, ulong? threadId = null, bool withComponents = true, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

messageId ulong

The ID of the message to modify.

action Action<MessageOptions>

The modification to apply to the message.

threadId ulong?

The ID of the thread the message is in.

withComponents bool

Whether to respect the modification's Components.

When enabled, allows application-owned webhooks to use all components, and non-owned webhooks to use non-interactive components.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<RestMessage>

ModifyWithTokenAsync(Action<WebhookOptions>, RestRequestProperties?, CancellationToken)

Modifies a webhook using the specified token, returning the updated Webhook object on success.

public Task<IncomingWebhook> ModifyWithTokenAsync(Action<WebhookOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

action Action<WebhookOptions>

The modification to perform on the webhook.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IncomingWebhook>

Remarks

Requires the ManageWebhooks permission, and fires a WebhooksUpdate event.

Does not allow modifiying the ChannelId property.

ToClient(WebhookClientConfiguration?)

Creates a usable WebhookClient from the webhook object directly.

public WebhookClient ToClient(WebhookClientConfiguration? configuration = null)

Parameters

configuration WebhookClientConfiguration

The configuration to pass to the client.

Returns

WebhookClient