Webhooks Guide

Send submitted, approved and rejected applications as signed JSON to Zapier, Make, n8n or your own system, and verify the signature. Part of the Integrations Guide.

What is sent and when

B2B Onboard can send your applications to an address you choose, as one signed JSON request per event: when an application is submitted, approved or rejected. You choose which of these events are sent. Use it to start a Zap in Zapier, a scenario in Make, a workflow in n8n, or to feed your ERP middleware or your own code. Available on the Growth and Pro plans.

  • One HTTPS POST per application and event, sent shortly after it happens. Every way of approving or rejecting counts: the application page, the Approve page, bulk actions, auto-approval and Shopify Flow. See Events.
  • The body holds the application (email, company, the Shopify customer and company IDs), every answered question, and the certificate details. Files are never sent; with the Shopify Flow certificate-link setting on, each certificate carries a time-limited download link.
  • Every request is signed with your signing secret, so your system can check that it came from B2B Onboard and was not changed on the way.
  • A webhook saved before events could be chosen sends Approved only, until you tick more. Applications submitted, approved or rejected before you turned an event on are not sent.

Set it up

Open Settings → Integrations → Webhook.

  • Endpoint URL: the address that should receive the requests. It must start with https:// and use the standard port. Internal and local addresses (such as localhost or a .local name), IP addresses and custom ports are refused, both when you save and again before every request. The address is stored encrypted.
  • Save. The app creates your signing secret and shows it once, in a yellow box. Copy it now and keep it with your system's other secrets. It is not shown again: afterwards the card shows only its last four characters.
  • Turn on Send applications to this URL, tick the Events to send (Submitted, Approved, Rejected; Approved is ticked to begin with) and save again. Nothing is sent until this is on, and turning it off stops it at once. With sending on, at least one event must be ticked.
  • Press Send test to send one sample application to the saved address (see Send test).

Lost the secret? Press Generate new secret. The new secret is shown once, and the old one stops working at once, so update your system before the next delivery.

To stop sending to the address and remove it, clear the Endpoint URL and save. The address and the secret are deleted.

Events

Tick the events you want under Events to send. Each event is sent with its own type:

EventtypeWhen it is sent
Submittedapplication.submittedA new application arrived and is waiting for review. An application held back (over your plan's monthly limit) or in Quarantine is sent as Submitted when it is released or restored.
Approvedapplication.approvedAn application was approved, in any way: the Approve page, bulk approval, auto-approval or Shopify Flow.
Rejectedapplication.rejectedAn application was rejected on its page, in a bulk reject or by Shopify Flow. The body carries rejectedAt and the rejectionReason you gave.
  • The webhook-id is <applicationId>.<event>, for example app_7f3c2a.submitted, and it is the same on every retry. One application can therefore arrive up to three times, once per event, each with its own ID.
  • Each event is sent at most once per application. If you reopen a rejected application and reject it again, the second reject is not sent.
  • For an application that is approved automatically, Submitted and Approved are sent at almost the same moment, and their order is not guaranteed. Use type to tell them apart, not the order of arrival.
  • data.application.status is the status when the request is sent, not when the event happened: the Submitted body of an application that was approved automatically can already say APPROVED.
  • New events are opt-in: a webhook you saved before events could be chosen keeps sending Approved only until you tick more.
  • Sample applications, test runs and imported applications are never sent.

The request

Each request is a POST with these headers. They follow the open Standard Webhooks format, so existing verification libraries work.

HeaderValue
content-typeapplication/json
user-agentB2B-Onboard-Webhooks/1
webhook-idThe ID of this event, <applicationId>.<event>, for example app_7f3c2a.approved. The same on every retry of the same application and event, so you can drop duplicates. Send test uses test. followed by 16 hexadecimal characters.
webhook-timestampWhen this attempt was sent, in seconds since 1 January 1970 (UTC). A new value on every attempt.
webhook-signaturev1, followed by the base64 HMAC-SHA256 signature (see Verify the signature).

Nothing else is sent: no Shopify token, no cookie, no login. The request never follows a redirect.

The payload

The body is JSON and has the same shape for every event. Example of an approved application:

{
  "id": "app_7f3c2a.approved",
  "type": "application.approved",
  "version": 1,
  "createdAt": "2026-11-28T10:15:02.114Z",
  "shopDomain": "your-store.myshopify.com",
  "data": {
    "application": {
      "id": "app_7f3c2a",
      "status": "APPROVED",
      "submittedAt": "2026-11-27T16:40:11.000Z",
      "approvedAt": "2026-11-28T10:14:58.000Z",
      "email": "buyer@example.com",
      "companyName": "Sample Wholesale Ltd",
      "shopifyCustomerId": "gid://shopify/Customer/7012345678901",
      "shopifyCompanyId": "gid://shopify/Company/1234567890"
    },
    "answers": [
      { "fieldId": "f_company", "question": "Company name", "key": "company_name", "type": "text", "value": "Sample Wholesale Ltd" },
      { "fieldId": "f_channels", "question": "Where do you sell?", "key": "where_do_you_sell", "type": "multiselect", "value": "Online, Retail store", "raw": ["Online", "Retail store"] },
      { "fieldId": "f_terms", "question": "I accept the terms", "key": "i_accept_the_terms", "type": "checkbox", "value": "Yes", "raw": true },
      { "fieldId": "f_address", "question": "Business address", "key": "business_address", "type": "address", "value": "1 Sample Street, Springfield, 12345, United States", "parts": { "city": "Springfield", "zip": "12345", "country": "US" } }
    ],
    "certificates": [
      {
        "certificateId": "cert_91b0",
        "fileName": "resale-certificate.pdf",
        "contentType": "application/pdf",
        "sizeBytes": 183422,
        "status": "VALID",
        "decision": "accepted",
        "certificateExpiresAt": "2028-12-31T00:00:00.000Z",
        "downloadUrl": "https://app.onboard.mentilead.com/api/flow-certificate/…",
        "linkExpiresAt": "2026-11-29T10:15:02.000Z"
      }
    ]
  }
}
KeyMeaning
idThe same value as the webhook-id header.
typeapplication.submitted, application.approved or application.rejected (see Events).
version1. New keys may be added under version 1; a key is never removed or renamed without a new version. Ignore keys you do not know.
createdAtWhen this body was built (ISO 8601, UTC).
shopDomainYour store's .myshopify.com domain.
testPresent, and true, only on a Send test request.
data.applicationid, status, submittedAt, approvedAt, rejectedAt, rejectionReason, email, companyName, shopifyCustomerId, shopifyCompanyId. status is the status at the moment of sending. approvedAt is present on an approved application; rejectedAt and rejectionReason (cut at 2,000 characters) on a rejected one. A key with no value is left out.
data.answersEvery answered question, in form order. fieldId is the stable identity of the question; key is made from its label and changes when you rename the question. value is the answer as shown in the app (a checkbox is Yes or No, a multi-select is joined with a comma). raw holds a multi-select's items or a checkbox's ticked state; parts holds an address's country, city and zip or a name's firstName and lastName. Values are cut at 2,000 characters. A file question carries its file names only.
data.certificatesNewest first, at most 20. File name, type, size, verification status, your decision (accepted, rejected or empty) and the certificate's expiry. downloadUrl and linkExpiresAt are filled only when the Shopify Flow certificate-link setting is on (with that setting's lifetime); otherwise they are empty. An application without certificates sends [].

Verify the signature

The signature is an HMAC-SHA256 over the text {webhook-id}.{webhook-timestamp}.{body}, where {body} is the RAW request body exactly as received. The key is the part of your secret after whsec_, base64-decoded. The result is base64-encoded and sent as v1,<signature>.

  • Read the raw body. Parsing the JSON and serialising it again changes the bytes, and the signature no longer matches.
  • Compare in constant time (crypto.timingSafeEqual, hmac.compare_digest).
  • Refuse a timestamp older than 5 minutes, so a captured request cannot be replayed later.
  • The header may hold several signatures separated by spaces; accept the request when any v1 signature matches.

Node.js

// Node.js 18 or later, standard library only.
const http = require('node:http');
const crypto = require('node:crypto');

// The signing secret from Settings → Integrations → Webhook (whsec_...).
const SECRET = process.env.B2B_ONBOARD_WEBHOOK_SECRET;
const KEY = Buffer.from(SECRET.slice('whsec_'.length), 'base64');
const TOLERANCE_SECONDS = 5 * 60;

function verify(headers, rawBody) {
  const id = headers['webhook-id'];
  const timestamp = headers['webhook-timestamp'];
  const signatureHeader = headers['webhook-signature'] || '';
  if (!id || !timestamp) return false;

  // Refuse old (or future) timestamps: a replayed request is turned away.
  const age = Math.abs(Date.now() / 1000 - Number(timestamp));
  if (!Number.isFinite(age) || age > TOLERANCE_SECONDS) return false;

  const expected = crypto.createHmac('sha256', KEY).update(`${id}.${timestamp}.${rawBody}`).digest();
  // The header may hold several space-separated signatures: accept any v1 match.
  return signatureHeader.split(' ').some((part) => {
    const [version, value] = part.split(',');
    if (version !== 'v1' || !value) return false;
    const given = Buffer.from(value, 'base64');
    return given.length === expected.length && crypto.timingSafeEqual(given, expected);
  });
}

http
  .createServer((req, res) => {
    const chunks = [];
    req.on('data', (chunk) => chunks.push(chunk));
    req.on('end', () => {
      // Verify the RAW body, byte for byte, before parsing it.
      const rawBody = Buffer.concat(chunks).toString('utf8');
      if (!verify(req.headers, rawBody)) {
        res.writeHead(401).end();
        return;
      }
      const event = JSON.parse(rawBody);
      // Drop a duplicate: event.id (the webhook-id header) is the same on every retry.
      console.log(event.type, event.data.application.id, event.test === true ? '(test)' : '');
      res.writeHead(204).end();
    });
  })
  .listen(3000);

Python

# Python 3.9 or later, standard library only.
import base64
import hashlib
import hmac
import json
import os
import time
from http.server import BaseHTTPRequestHandler, HTTPServer

# The signing secret from Settings → Integrations → Webhook (whsec_...).
SECRET = os.environ["B2B_ONBOARD_WEBHOOK_SECRET"]
KEY = base64.b64decode(SECRET.removeprefix("whsec_"))
TOLERANCE_SECONDS = 5 * 60


def verify(headers, raw_body: bytes) -> bool:
    msg_id = headers.get("webhook-id")
    timestamp = headers.get("webhook-timestamp")
    signature_header = headers.get("webhook-signature", "")
    if not msg_id or not timestamp:
        return False
    # Refuse old (or future) timestamps: a replayed request is turned away.
    try:
        if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS:
            return False
    except ValueError:
        return False
    signed = f"{msg_id}.{timestamp}.".encode() + raw_body
    expected = base64.b64encode(hmac.new(KEY, signed, hashlib.sha256).digest()).decode()
    # The header may hold several space-separated signatures: accept any v1 match.
    # Compare bytes: compare_digest refuses a str with non-ASCII characters.
    for part in signature_header.split(" "):
        version, _, value = part.partition(",")
        if version == "v1" and hmac.compare_digest(value.encode(), expected.encode()):
            return True
    return False


class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        # Verify the RAW body, byte for byte, before parsing it.
        # Any error while checking (a malformed header or length) answers 401, never 500.
        try:
            raw = self.rfile.read(int(self.headers.get("Content-Length", 0)))
            verified = verify(self.headers, raw)
        except Exception:
            verified = False
        if not verified:
            self.send_response(401)
            self.end_headers()
            return
        event = json.loads(raw)
        # Drop a duplicate: event["id"] (the webhook-id header) is the same on every retry.
        print(event["type"], event["data"]["application"]["id"])
        self.send_response(204)
        self.end_headers()


HTTPServer(("", 8000), Handler).serve_forever()

Libraries

The Standard Webhooks libraries (JavaScript, Python, Go, Java, Ruby, PHP, C# and more) verify these requests for you: pass them your full whsec_ secret, the three headers and the raw body.

Success, duplicates and retries

  • Success is any 2xx answer within 8 seconds. Answer quickly and do slow work afterwards. The answer's body is never read.
  • Redirects are not followed. A 3xx answer counts as a failure: enter the final address instead.
  • When your endpoint does not answer in time, answers 408, 425 or 429, or reports a server error (5xx), the app tries again by itself: three tries within a few minutes. The application's Integration deliveries card then shows Failed with a plain sentence and a Retry button.
  • Any other answer (401, 403, 404, 410, another 4xx), an invalid certificate or a refused address fails at once, with the reason and a Retry button.
  • If a delivery stays Pending for more than 15 minutes, press Retry.
  • Duplicates: a retry, automatic or by hand, sends the same webhook-id. Keep the IDs you have handled and drop a request whose ID you have seen.

Send test

Send test sends one sample application to the saved address, signed like a real one and marked "test": true. The sample uses the email applicant@example.com, the company Sample Wholesale Ltd, three sample answers and no certificates. It works with sending switched off, so you can set up your Zap or scenario first. The card shows your endpoint's answer, for example Your endpoint answered 200., or what went wrong. You can send 5 tests every 10 minutes. A test creates no delivery on any application.

Zapier, Make and n8n

A plain catch hook in these tools accepts any request to its address and does not check the signature. With a plain catch hook, the secrecy of the hook address is the protection: treat it like a password, and never post it in a public place. Where the tool lets you run code, add the check below.

Zapier

  • Create a Zap with the trigger Webhooks by Zapier → Catch Hook. Copy the webhook URL Zapier shows, paste it into Endpoint URL, save, and press Send test: Zapier picks up the sample as its test record.
  • Map the fields you need from data.application and data.answers in the next steps.
  • To check the signature, use Catch Raw Hook instead (it keeps the raw body and the headers), then a Code by Zapier step:
// Zapier Code by Zapier step (JavaScript). Under Input Data, add four fields
// named raw_body, webhook_id, webhook_timestamp and webhook_signature. Map them
// from the Catch Raw Hook step: the raw body, and the values of the three
// webhook- headers from the request (webhook-id, webhook-timestamp,
// webhook-signature). Zapier may label the headers differently in its picker.
const crypto = require('crypto');
const key = Buffer.from('whsec_YOUR_SECRET'.slice('whsec_'.length), 'base64');
const expected = crypto
  .createHmac('sha256', key)
  .update(`${inputData.webhook_id}.${inputData.webhook_timestamp}.${inputData.raw_body}`)
  .digest('base64');
const ok = (inputData.webhook_signature || '').split(' ').includes(`v1,${expected}`);
const fresh = Math.abs(Date.now() / 1000 - Number(inputData.webhook_timestamp)) <= 300;
if (!ok || !fresh) throw new Error('Signature does not match: stopping this run.');
return { verified: true, body: inputData.raw_body };

The Code step stops the Zap when the signature does not match. Keep the secret in the step only, and parse raw_body with a Formatter or another Code step afterwards.

Make

  • Start a scenario with Webhooks → Custom webhook, add a webhook and copy its address into Endpoint URL.
  • Press Re-determine data structure in Make, then Send test in B2B Onboard, so Make learns the payload's keys.
  • A Custom webhook does not check the signature. Keep its address secret, or send the requests to your own code first and pass them on from there.

n8n

  • Add a Webhook node with the method POST and use its production URL as Endpoint URL (the test URL only listens while you watch the editor).
  • To check the signature, turn on the node's Raw Body option and add a Crypto or Code node after it. The check needs the key as bytes (the base64-decoded part after whsec_); if your Crypto node only takes the secret as text, use a Code node with the Node.js sample above. Stop the workflow when the signatures differ.

Privacy and limits

  • When sending is on, the email, answers and certificate details (and, with the Flow certificate-link setting on, time-limited certificate links) of each application you choose to send (submitted, approved, rejected) are sent to your address. Make sure your privacy notice tells applicants.
  • You choose the address and you are the controller of that transfer and of what the receiving system does with the data; we send it on your instruction as your processor. The receiving system is yours, not our sub-processor. See our Privacy Policy.
  • The address and the signing secret are stored encrypted, are never written to our logs, and are deleted when you clear the address or uninstall the app.
  • Requests go only to public https addresses on the standard port. Custom headers, basic authentication, custom ports and fixed source IP addresses are not offered.
  • One address per store. The Submitted, Approved and Rejected events only (a request for more information is not sent). Imported applications are not sent.
  • Growth and Pro plans.