Skip to content
Skillv1.0.0

alchemy-webhooks-events

Implement Alchemy Notify webhooks for real-time blockchain event notifications. Use when tracking wallet activity, monitoring mined transactions, watching smart contract events, or building real-time

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (plugins/saas-packs/alchemy-pack/skills/alchemy-webhooks-events/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill alchemy-webhooks-events. Copyright stays with the author (MIT).

Alchemy Webhooks & Events (Notify API)

Overview

Alchemy Notify provides real-time push notifications for on-chain events. Instead of polling, receive webhook callbacks for wallet activity, mined transactions, dropped transactions, and smart contract events.

Webhook Types

Type Trigger Use Case
Address Activity ETH/token transfer to/from address Wallet notifications
Mined Transaction Transaction confirmed on-chain Payment confirmation
Dropped Transaction Transaction removed from mempool Failed tx alerting
NFT Activity NFT transfer events Marketplace notifications
Custom Webhook GraphQL-defined filter Complex event tracking

Prerequisites

  • A TLS-protected callback URL, signing key in managed storage, and a handler that receives the raw body before JSON parsing for signature verification.
  • Persistent idempotency storage, validated address/filter configuration, and a least-privilege workflow token for webhook management.
  • A product decision for reorganization, duplicate delivery, unavailable callbacks, and event types that require user-visible confirmation.

Instructions

Step 1: Create Webhook via Dashboard or API

# Create Address Activity webhook via Alchemy API
curl -X POST "https://dashboard.alchemy.com/api/create-webhook" \
  -H "X-Alchemy-Token: ${ALCHEMY_AUTH_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "ETH_MAINNET",
    "webhook_type": "ADDRESS_ACTIVITY",
    "webhook_url": "https://your-app.com/webhooks/alchemy",
    "addresses": [
      "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
    ]
  }'

Step 2: Webhook Handler with Signature Verification

// src/webhooks/alchemy-handler.ts
import express from 'express';
import crypto from 'crypto';

const router = express.Router();

router.post('/webhooks/alchemy',
  express.raw({ type: 'application/json' }),
  async (req, res) => {
    // Verify webhook signature
    const signature = req.headers['x-alchemy-signature'] as string;
    if (!verifySignature(req.body.toString(), signature)) {
      return res.status(401).json({ error: 'Invalid signature' });
    }

    const event = JSON.parse(req.body.toString());
    await processAlchemyEvent(event);
    res.status(200).json({ ok: true });
  }
);

function verifySignature(body: string, signature: string): boolean {
  const signingKey = process.env.ALCHEMY_WEBHOOK_SIGNING_KEY!;
  const hmac = crypto.createHmac('sha256', signingKey);
  hmac.update(body, 'utf8');
  const digest = hmac.digest('hex');
  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(digest));
}

Step 3: Event Router

// src/webhooks/event-router.ts
interface AlchemyWebhookEvent {
  webhookId: string;
  id: string;
  createdAt: string;
  type: 'ADDRESS_ACTIVITY' | 'MINED_TRANSACTION' | 'DROPPED_TRANSACTION' | 'NFT_ACTIVITY';
  event: {
    network: string;
    activity: Array<{
      fromAddress: string;
      toAddress: string;
      value: number;
      asset: string;
      category: 'external' | 'internal' | 'erc20' | 'erc721' | 'erc1155';
      hash: string;
      blockNum: string;
    }>;
  };
}

async function processAlchemyEvent(event: AlchemyWebhookEvent): Promise<void> {
  switch (event.type) {
    case 'ADDRESS_ACTIVITY':
      for (const activity of event.event.activity) {
        console.log(`${activity.category} transfer: ${activity.value} ${activity.asset}`);
        console.log(`  From: ${activity.fromAddress}`);
        console.log(`  To: ${activity.toAddress}`);
        console.log(`  Tx: ${activity.hash}`);
        // Trigger application logic (e.g., update balance, send notification)
      }
      break;

    case 'MINED_TRANSACTION':
      console.log('Transaction mined:', event.event);
      break;

    case 'DROPPED_TRANSACTION':
      console.log('Transaction dropped:', event.event);
      // Alert user their transaction was dropped
      break;

    case 'NFT_ACTIVITY':
      for (const activity of event.event.activity) {
        console.log(`NFT transfer: ${activity.asset} #${activity.value}`);
      }
      break;
  }
}

Step 4: Programmatic Webhook Management

// src/webhooks/manage-webhooks.ts
import { Alchemy, Network, WebhookType } from 'alchemy-sdk';

const alchemy = new Alchemy({
  apiKey: process.env.ALCHEMY_API_KEY,
  network: Network.ETH_MAINNET,
  authToken: process.env.ALCHEMY_AUTH_TOKEN, // Required for Notify API
});

async function setupAddressWebhook(addresses: string[], webhookUrl: string) {
  const webhook = await alchemy.notify.createWebhook(
    webhookUrl,
    WebhookType.ADDRESS_ACTIVITY,
    { addresses, network: Network.ETH_MAINNET }
  );
  console.log(`Webhook created: ${webhook.id}`);
  return webhook;
}

async function listWebhooks() {
  const webhooks = await alchemy.notify.getAllWebhooks();
  for (const wh of webhooks.webhooks) {
    console.log(`${wh.id}: ${wh.webhookType} → ${wh.webhookUrl} (${wh.isActive ? 'active' : 'inactive'})`);
  }
}

async function addAddressToWebhook(webhookId: string, newAddresses: string[]) {
  await alchemy.notify.updateWebhook(webhookId, {
    addAddresses: newAddresses,
  });
}

Output

  • Address Activity webhook for wallet monitoring
  • HMAC signature verification for webhook security
  • Event router handling all Alchemy webhook types
  • Programmatic webhook management via Notify API

Examples

Create a sandbox or development callback for a public test address, then send one valid synthetic ADDRESS_ACTIVITY payload and the exact duplicate event. Verify the handler checks the raw-body signature, persists the event ID before side effects, and returns a duplicate-safe response for the second delivery. Capture only event IDs, network, status, and timing in logs. If signature verification fails, the endpoint is unreachable, or a downstream update fails, quarantine the event for bounded replay after the fault is fixed; do not process an unverified payload or silently discard a user-impacting event.

Error Handling

Issue Cause Solution
Invalid signature Wrong signing key Copy from Alchemy webhook details page
Missing events Webhook URL not reachable Ensure HTTPS endpoint is publicly accessible
Duplicate events No idempotency Track webhook event IDs

Resources

Next Steps

For performance optimization, see alchemy-performance-tuning.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-alchemy-webho-efdbe0/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-alchemy-webho-efdbe0.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-alchemy-webho-efdbe0",
  "kind": "skill",
  "name": "alchemy-webhooks-events",
  "description": "Implement Alchemy Notify webhooks for real-time blockchain event notifications. Use when tracking wallet activity, monitoring mined transactions, watching smart contract events, or building real-time dApp features. Trigger: \"alchemy webhook\", \"alchemy notify\", \"alchemy events\", \"alchemy address activity\", \"alchemy real-time notifications\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "legal"
    ],
    "tags": [
      "skill-md",
      "saas",
      "blockchain",
      "web3",
      "alchemy",
      "webhooks",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Implement Alchemy Notify webhooks for real-time blockchain event notifications. Use when tracking wallet activity, monitoring mined transactions, watching smart contract events, or building real-time dApp features. Trigger: \"alchemy webhook\", \"alchemy notify\", \"alchemy events\", \"alchemy address activity\", \"alchemy real-time notifications\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "plugins/saas-packs/alchemy-pack/skills/alchemy-webhooks-events/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/plugins/saas-packs/alchemy-pack/skills/alchemy-webhooks-events/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/plugins/saas-packs/alchemy-pack/skills/alchemy-webhooks-events/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit,",
      "Bash(curl:*)"
    ],
    "license": "MIT"
  },
  "instructions": "# Alchemy Webhooks & Events (Notify API)\n\n## Overview\n\nAlchemy Notify provides real-time push notifications for on-chain events. Instead of polling, receive webhook callbacks for wallet activity, mined transactions, dropped transactions, and smart contract events.\n\n## Webhook Types\n\n| Type | Trigger | Use Case |\n|------|---------|----------|\n| Address Activity | ETH/token transfer to/from address | Wallet notifications |\n| Mined Transaction | Transaction confirmed on-chain | Payment confirmation |\n| Dropped Transaction | Transaction removed from mempool | Failed tx alerting |\n| NFT Activity | ",
  "cost": {
    "context_tokens": 1688
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-alchemy-webho-efdbe0/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.