Back

    Buyamia Directory API

    v1.0

    Webhooks

    Register webhook subscriptions to receive real-time notifications when events occur in the Directory. Webhooks are delivered as HTTP POST requests to your specified URL with HMAC-SHA256 signature verification.

    All webhook endpoints require the webhooks.manage permission scope.

    Endpoints

    POST
    /v1/webhooks

    Register a new webhook subscription

    webhooks.manage
    GET
    /v1/webhooks

    List active subscriptions

    webhooks.manage
    DELETE
    /v1/webhooks/:id

    Remove a subscription

    webhooks.manage

    Event Types

    EventTriggerPayload
    rfq.createdNew RFQ created via inbound APIRFQ object with items
    rfq.status_changedRFQ status updatedRFQ object with old/new status
    rfq.quote_submittedNew supplier quote submittedQuote object with line items
    business.createdNew business listing addedBusiness object
    business.updatedBusiness data updatedBusiness object with changed fields
    product.createdNew product addedProduct object
    product.updatedProduct data updatedProduct object
    product.price_changedProduct price changedProduct with old/new price

    Register a Webhook

    POST /v1/webhooksjson
    {
      "event_type": "rfq.quote_submitted",
      "target_url": "https://sourcing.buyamia.com/api/webhooks/directory",
      "secret": "your-webhook-signing-secret"
    }

    Signature Verification

    Each webhook delivery includes an X-Webhook-Signature header containing an HMAC-SHA256 signature of the request body using your webhook secret. Always verify this signature before processing the payload.

    Verify Signaturetypescript
    import { createHmac } from 'crypto';
    
    function verifyWebhook(body: string, signature: string, secret: string): boolean {
      const expected = createHmac('sha256', secret)
        .update(body)
        .digest('hex');
      return signature === expected;
    }
    
    // In your webhook handler:
    app.post('/api/webhooks/directory', (req, res) => {
      const signature = req.headers['x-webhook-signature'];
      const body = JSON.stringify(req.body);
      
      if (!verifyWebhook(body, signature, process.env.WEBHOOK_SECRET)) {
        return res.status(401).json({ error: 'Invalid signature' });
      }
      
      // Process the event
      const { event_type, data } = req.body;
      console.log(`Received ${event_type}:`, data);
      
      res.status(200).json({ received: true });
    });

    Webhook Payload Format

    {
      "event_type": "rfq.quote_submitted",
      "timestamp": "2026-03-03T10:30:00Z",
      "data": {
        "rfq_id": "uuid",
        "external_rfq_id": "PROC-2026-0042",
        "supplier_id": "uuid",
        "business_name": "PT Furniture Jaya",
        "quoted_price": 4500000,
        "quoted_currency": "IDR"
      }
    }
    Last updated on February 23, 2026