deleteWebhook - SDK

Delete the provided webhook.

Don’t have an API key?

Start using this method in your app today.

Description

Delete the provided webhook.

Parameters

NameTypeDescription
webhookstringThe webhook to delete.

Response

PropertyTypeDescription
Promise<void>voidReturns nothing.

Example Request and Response

Prerequisite: You will need to install the Alchemy SDK before making requests with it.

The commands for installing it using npm or yarn are given below:

npm install alchemy-sdk@latest
yarn add alchemy-sdk@latest

Request

// Setup: npm install alchemy-sdk
// Github: https://github.com/alchemyplatform/alchemy-sdk-js
import { Alchemy, Network, WebhookType } from "alchemy-sdk";

// authToken is required to use Notify APIs. Found on the top right corner of
// https://dashboard.alchemy.com/notify.
const settings = {
  authToken: "your-notify-auth-token",
  network: Network.ETH_MAINNET, // Replace with your network.
};

const alchemy = new Alchemy(settings);

const minedTxWebhook = await alchemy.notify.createWebhook(
  "https://webhook.site/your-webhook-url",
  WebhookType.MINED_TRANSACTION,
  { appId: "wq9fgv022aff81pg" }
);

//Perform deletion of Webhooks
const deleteViaWebhookID = await alchemy.notify.deleteWebhook("wh_qv16bt12wbj9kax4");
const deleteMinedTxWebhook = await alchemy.notify.deleteWebhook(minedTxWebhook);

Response

{}

Use Cases

Here are some potential use cases for the deleteWebhook method:

  • Updating webhook settings: If you need to update the URL or other settings of a webhook, you can delete the existing webhook using thedeleteWebhook method and then create a new one with the updated settings using createWebhook.

  • Removing unused webhooks: If you have created a webhook that is no longer needed, you can delete it using deleteWebhook to clean up your API and reduce clutter.

  • Resolving issues with a webhook: If you are experiencing issues with a webhook, deleting it and creating a new one can help resolve the issue.

  • Revoking access: If you need to revoke access to your API for a particular webhook, you can delete it using deleteWebhook.

Related Methods

  • createWebhook - Create a new Webhook to track transactions sent by the app associated with the app id.
  • updateWebhook - Update a webhook address.
ReadMe