Skip to main content
Myaza sends a POST request to your endpoint whenever a monitored address receives a transaction.

Webhook Payload

{
  "id": "wh_123e4567-e89b-12d3-a456-426614174000",
  "chain": "polygon",
  "address": "0x1A2B3C4D...", // your monitored address
  "addressFrom": "0xSENDER...", // the sender
  "symbol": "USDC",
  "contractAddress": "0x2791Bca...",
  "amount": "100.0",
  "txId": "0xabcdef...",
  "blockNumber": 58234123,
  "subscriptionType": "ADDRESS_TRANSACTION",
  "swept": false,
  "status": "delivered",
  "createdAt": "2025-03-21T10:00:00.000Z"
}

Setting Up Your Endpoint

Your webhook endpoint must:
  1. Accept POST requests with JSON body
  2. Return 200 OK within 10 seconds — or Myaza will consider delivery failed and retry
  3. Be publicly accessible via HTTPS
// Node.js / Express example
app.post("/webhooks/myaza", express.json(), async (req, res) => {
  // Step 1: Acknowledge IMMEDIATELY
  res.status(200).json({ ok: true });

  // Step 2: Process asynchronously
  const event = req.body;
  await processTransaction(event);
});

Retry Policy

If your endpoint does not return 200, Myaza retries with exponential backoff:
AttemptDelay
1st retry1 minute
2nd retry5 minutes
3rd retry30 minutes
4th retry2 hours
5th retry6 hours
After 5 failed attempts, the webhook is marked failed. You can manually retrigger it from the dashboard or via the Retrigger API.

Idempotency

Your endpoint may receive the same webhook multiple times (retries, network issues). Always design for idempotency:
async function processTransaction(event) {
  // Check if we've already processed this transaction
  const existing = await db.transactions.findOne({ txId: event.txId });
  if (existing) {
    console.log("Duplicate webhook, skipping:", event.txId);
    return;
  }

  // Process for the first time
  await db.transactions.create({
    txId: event.txId,
    chain: event.chain,
    address: event.address,
    amount: event.amount,
    symbol: event.symbol,
    processedAt: new Date(),
  });

  await fulfillOrder(event);
}

Verifying Webhooks

To confirm the request came from Myaza, check that the address in the payload matches one of your monitored addresses:
async function processTransaction(event) {
  // Verify the address belongs to your business
  const monitored = await db.monitoredAddresses.findOne({
    address: event.address,
    chain: event.chain,
  });

  if (!monitored) {
    console.warn("Received webhook for unknown address:", event.address);
    return;
  }

  // Safe to process
}
Webhook signature verification (HMAC) is on the Myaza roadmap. Watch the Changelog for updates.

Testing Webhooks Locally

Use a tunnel like ngrok to expose your local server during development:
# Start your server
node server.js  # listening on port 3000

# In another terminal, expose it publicly
ngrok http 3000
# → https://abc123.ngrok.io
Set https://abc123.ngrok.io/webhooks/myaza as your webhook URL in the dashboard, then send a test transaction.

Monitoring Delivery

View all webhook events and their delivery status in the dashboard, or via the API:
# See failed webhooks
curl "https://secureapi.gridlog.io/api/v1/webhooks?status=failed" \
  -H "Authorization: Bearer YOUR_JWT"

# Retrigger a failed one
curl -X POST "https://secureapi.gridlog.io/api/v1/webhooks/wh_123.../retrigger" \
  -H "Authorization: Bearer YOUR_JWT"