IntegrationsAdvanced

Custom Webhook Integration

Connect any system to DMHub using webhooks — both inbound (receive events from external apps) and outbound (send events to your systems).

6 min readUpdated May 14, 2025

Two types of webhooks

Inbound webhooks — external systems push events to DMHub. Example: your ordering system sends an event when a customer places an order.

Outbound webhooks — DMHub pushes events to your systems. Example: when a conversation is resolved, DMHub notifies your CRM.

Setting up an inbound webhook

  1. Go to /settings/integrationsWebhooks → New Inbound Webhook
  2. Give it a name and choose the event type you'll receive
  3. Copy the generated webhook URL:

``` https://www.dmhub.ai/api/webhooks/inbound/wh_abc123xyz ```

  1. Paste this URL in your external system as the webhook destination

Payload format

DMHub expects JSON payloads. The structure depends on what you're mapping, but a common pattern:

{
  "event": "order.placed",
  "customer": {
    "phone": "+12025551234",
    "email": "customer@example.com",
    "name": "Jane Smith"
  },
  "data": {
    "order_id": "ORD-789",
    "total": 49.99,
    "items": [...]
  }
}

Field mapping

After saving the webhook URL, configure field mapping in DMHub:

  • Map customer.phone → DMHub contact phone
  • Map data.order_id → tag or custom attribute on the conversation
  • Trigger an automation when this event fires

Setting up an outbound webhook

  1. Go to /settings/integrationsWebhooks → New Outbound Webhook
  2. Enter your system's receiving URL
  3. Select the DMHub events to send:

- conversation.created - conversation.resolved - message.sent - contact.created

  1. Optionally add custom headers (e.g., an API key for your receiving system)

Verifying webhook signatures

Outbound webhooks include a signature header X-DMHub-Signature so you can verify the payload is genuine:

const crypto = require('crypto');

function verifySignature(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(signature)
  );
}

The webhook secret is shown once when you create the outbound webhook — store it securely.

Debugging webhooks

Go to /settings/integrations → your webhook → Delivery Log to see:

  • Each delivery attempt
  • Request/response body
  • HTTP status code
  • Retry history (DMHub retries failed webhooks 3 times with exponential backoff)
webhooksapiintegrationsadvanced

Was this article helpful?

Let us know if this answered your question or if you need more help.

Send feedback
Custom Webhook Integration | DMHub Help