Skip to content

WebHooks

Marco Cusano edited this page Jun 4, 2019 · 1 revision

channel external-link

Returns a list of channel webhook objects. Requires the MANAGE_WEBHOOKS permission.

$discord->webhooks->channel("CHANNEL_ID");

create external-link

Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success.

$scope = "channel"; // or "guild"
$params = array( "name" => "WebHookName" );
$discord->webhooks->create($scope, $params);

delete external-link

Delete a webhook permanently. User must be owner. Returns a 204 NO CONTENT response on success.

$discord->webhooks->delete("WEBHOOK_ID");

edit external-link

Modify a webhook. Requires the MANAGE_WEBHOOKS permission. Returns the updated webhook object on success.

$params = array( "name" => "NewWebHookName" );
$discord->webhooks->edit("WEBHOOK_ID", $params);

execute (alpha) external-link

This endpoint supports both JSON and form data bodies. It does require multipart/form-data requests instead of the normal JSON request type when uploading files. Make sure you set your Content-Type to multipart/form-data if you're doing that. Note that in that case, the embeds field cannot be used, but you can pass an url-encoded JSON body as a form value for payload_json.

$discord->webhooks->execute("WEBHOOK_ID", "WEBHOOK_TOKEN");

get external-link

Returns the new webhook object for the given id.

$discord->webhooks->get("WEBHOOK_ID");

guild external-link

Returns a list of guild webhook objects. Requires the MANAGE_WEBHOOKS permission.

$discord->webhooks->guild("GUILD_ID");