Integration document
POST
Production webhook (JSON). Keep your API key server-side; rotate via env
DNADI_WEBHOOK_X_API_KEY on the n8n container.
Endpoint URL
https://n8n.dnadi.food/webhook/external-order-intake
Example cURL
curl -sS -X POST 'https://n8n.dnadi.food/webhook/external-order-intake' \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_DNADI_WEBHOOK_X_API_KEY' \
-d '{"order_type":"new","source":"partner_demo","customer_name":"Ali","address":"Smouha, Alexandria","phone":"201012345678","requested_products":[{"name":"Item A","qty":2,"unit_price":25}],"raw_customer_message":"full raw text","customer_message_summary":"short summary"}'
Canonical JSON payload
{
"order_type": "new",
"source": "partner_name",
"customer_name": "Customer name",
"address": "Full delivery address",
"phone": "+201012345678",
"requested_products": [
{ "name": "Product A", "qty": 2, "unit_price": 25, "notes": "" }
],
"raw_customer_message": "Full raw customer message from the channel",
"customer_message_summary": "One-line summary for operators",
"order_number": "EXT-10025",
"alternate_phone": "",
"customer_notes": ""
}
Headers
| Header | Required | Notes |
|---|---|---|
x-api-key (or X-Api-Key) |
Yes |
Must match DNADI_WEBHOOK_X_API_KEY in n8n. On mismatch the workflow returns
401 { "ok": false, "error": "unauthorized" }.
|
Content-Type |
Recommended | application/json; charset=utf-8 |
Field reference
Required fields (non-empty after trim; requested_products must be a non-empty array):
| Field | Type | Description |
|---|---|---|
order_type |
string |
new, modify, urgent, cancel, or
support (English). Arabic tokens such as جديد, تعديل,
استعجال, الغاء/إلغاء, دعم are normalized by the
workflow.
|
source |
string | External system identifier (e.g. mojeeb, easy_orders). |
customer_name |
string | Customer display name. |
address |
string | Delivery address or location description. |
phone |
string | Primary phone (used for matching / downstream routing). |
requested_products |
array | Line items; each item should include name and qty (default qty 1 if invalid). |
raw_customer_message |
string | Verbatim text from the external channel. |
customer_message_summary |
string | Short operator-facing summary. |
Optional fields
| Field | Description |
|---|---|
order_number |
External reference / ticket id (passed through as external_ref when forwarded). |
alternate_phone |
Secondary phone. |
customer_notes |
Extra free-form notes. |
Routing (n8n)
After validation the workflow computes route_key:
route_new, route_modify, route_urgent, route_cancel,
route_support.
-
route_new— forwards toPOST /webhook/phone-order-parse(existing phone-order pipeline). -
route_support— intended path: admin / support ticketing (wire the HTTP branch in n8n toadmin-order-supportor your internal ticket flow when ready). - Other route keys may return a structured stub until additional branches are connected in the editor.
Import and activate dnadi/workflows/n8n-external-order-intake.json on the n8n instance. Set env
DNADI_WEBHOOK_X_API_KEY and credentials for downstream HTTP nodes.
Notifications setup (OneSignal)
Operator and driver surfaces on https://ops.dnadi.food and https://driver.dnadi.food
load the OneSignal Web SDK (v16) with serviceWorkerPath: OneSignalSDKWorker.js at the site root.
-
Ops / dispatch —
assets/ops-onesignal-init.jsregistersOneSignal.login('dnadi_ops_broadcast')for broadcast pushes (e.g. driver → ops). -
Driver — after login,
OneSignal.login(driver_uuid)ties the device to the driver id for n8n → OneSignal REST pushes. -
Nginx —
ops.dnadi.foodserves/OneSignalSDKWorker.jsand/assets/favicon.pngwithout HTTP Basic Auth so browsers can register the worker and default icon URLs.