Event contract between a voice session and n8n
Send n8n a structured event with session ID, event ID, verified actor, consent state and requested slot, separate from the quick availability reply.
By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 7 minutes to read.
In short
The quick availability reply and the slower workflow work are two different jobs. The voice session sends n8n a structured event with a session ID, an event ID, the verified actor, consent state and the requested slot. n8n reviews and acts later, then the caller is told the result.
Explained simply
A contract is an agreement about shape. The voice service and n8n agree on exactly what an event looks like, so neither side has to guess. You write the schema first, then build both ends to match it.
An event carries a session ID, so you can find the whole call later. It also carries an event ID that is unique for each event, so n8n can spot a duplicate if the same event arrives twice.
The event says who the caller is and whether they agreed to things like a text confirmation. Your server decides those facts. n8n only reads them.
Speed matters. The voice side asks n8n to take the event and gets an immediate answer. The review, approval and calendar write happen after that. When it is done, the caller is told by text or a call back.
Press Play on a diagram to walk through it one step at a time.
- Voice session to Tool adapter: Propose booking for Tuesday 3 pm1Propose booking for Tuesday 3 pm
- Tool adapter to n8n: POST event with IDs, actor, consent, slot2POST event with IDs, actor, consent, slot
- n8n to Tool adapter: 202 Accepted (reply fast)3202 Accepted (reply fast)
- Tool adapter to Voice session: Requested, awaiting approval4Requested, awaiting approval
- 5Review, approve, write calendarn8n to n8n: Review, approve, write calendar
- n8n to Voice session: Later: confirmation by text6Later: confirmation by text
- 1Webhook trigger
Receives the event.
- 2Validate and dedupe
Check schema and event ID.
- 3Notify reviewer
Approval request.
- 4Write calendar
Only after approval.
- 5Confirm to caller
Text or callback.
In depth
Design the schema
Write a JSON Schema for the event and keep a version field. Required fields: schema_version, event_id, session_id, type, actor, consent and slot. Use fixed values for type, such as booking.proposed. Reject unknown fields at the edge so the contract stays tight. Share the schema file between both teams, and bump the version for breaking changes.
- schema_version for change control
- Fixed values for type
- Required and optional fields stated
- One shared schema file
IDs and idempotency
Networks retry. The event ID makes a retry harmless: n8n stores seen event IDs and skips repeats. The session ID links every event of a call, which helps with debugging and reports. Generate the event ID on the sender, once, before the first attempt. Reuse the same ID on every retry.
- Adapter to n8n: POST event evt_11POST event evt_1
- n8n to Adapter: Timeout, no reply seen2Timeout, no reply seen
- Adapter to n8n: Retry POST event evt_13Retry POST event evt_1
- 4evt_1 already seen, skipn8n to n8n: evt_1 already seen, skip
- n8n to Adapter: 200 OK, no duplicate work5200 OK, no duplicate work
Verified actor and consent
The actor field is set by your server after it checks the caller. Consent is set by the conversation, for example the caller agreed to a text confirmation. n8n should not infer either from free text. Also secure the webhook: use a secret header or other authentication supported by the Webhook node, and accept only HTTPS.
Reply fast, review later
Set the n8n Webhook node to respond immediately, or use a Respond to Webhook node early in the flow. The adapter gets 202 or 200 in milliseconds. The rest of the workflow validates the event, notifies a reviewer and writes to the calendar when approved. The final step sends the confirmation to the caller through the agreed channel.
- Respond early from the webhook
- Validate the event first inside n8n
- Review and write in later steps
- Send confirmation last
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Define the event schema~30m
- 2Include session and event IDs~30m
- 3Carry the verified actor and consent~30m
- 4Reply fast, review asynchronously~30m
- 5Confirm back to the caller later~30m
Key points
- Write the event as a versioned JSON schema before building the workflow.
- Include session_id and a unique event_id so retries do not duplicate work.
- Carry the verified actor and consent state. Do not make n8n guess them.
- Reply to the voice session quickly. Do the slow review asynchronously.
- Confirm back to the caller later by a channel they agreed to, such as text.
Key terms
Tap a card to flip it. 0/5 known
Examples
{
"schema_version": "1",
"event_id": "evt_01HZ-example",
"session_id": "ses_8f3a",
"type": "booking.proposed",
"actor": { "caller_id": "c_123", "verified": true },
"consent": { "sms_confirmation": true },
"slot": { "start": "2026-12-08T15:00:00+00:00", "time_zone": "Europe/London", "duration_minutes": 30 }
}One proposal event sent to an n8n Webhook node.
Send the event
The adapter posts the event to a placeholder n8n webhook, with a shared secret in a header. The same event ID is reused on a retry. Replace the URL and secret with your own and keep the secret out of source control.
curl -sS -X POST https://n8n.example.com/webhook/booking-proposed \
-H "Content-Type: application/json" \
-H "X-Webhook-Secret: <secret>" \
-d @event.jsonDuplicate delivery
The first request times out on the voice side, but n8n did receive it. The adapter retries with the same event ID. n8n sees the ID in its seen list and stops. The reviewer gets one approval request, not two.
Quick reference
- Write the schema first and version it.
- event_id is unique per event and reused on retries.
- session_id ties all events in one call together.
- Actor and consent come from your server, not from n8n guesses.
- Respond early from the webhook; do review later.
- Authenticate the webhook and use HTTPS.
Common mistakes
- Making the caller wait on the whole workflow instead of replying 202 and continuing.
- No event ID, so a retried request creates two proposals.
- Sending the full transcript when the workflow only needs the slot.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
List the required fields of the booking.proposed event.
- Exercise 2medium
Write a JSON Schema fragment requiring event_id and slot.start as a date-time string.
- Exercise 3hard
Design a dedupe step for n8n using a data table or database: what is stored and what happens on a repeat?
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Why not just send the whole transcript?
- n8n needs only the structured fields. Less data means less privacy risk and a simpler contract.
- How do I secure the n8n webhook?
- Use HTTPS and an authentication option on the Webhook node, such as a header secret. Keep the secret out of source control.
- What does 202 mean here?
- Accepted: the event was received and will be processed later.