This article was drafted with AI help and reviewed by the author.

A common first build for a phone agent looks like this. A call comes in. Twilio hits an n8n webhook. n8n looks up the caller in GoHighLevel, checks business hours, writes a log row, maybe pings Slack, and only then returns the TwiML that connects the call to the voice agent.

It works in testing. Then a CRM call is slow one afternoon, and every caller hears silence before anything happens. Or the workflow errors halfway, and the caller hears a Twilio error message instead of your agent.

The idea in this post is simple. The voice webhook should return TwiML right away and nothing else. Everything else moves to work that runs after the call is connected, or after it ends. Platform details come from the Twilio webhook and Media Streams pages and n8n's Webhook node page, as they stood on 27 November 2026. Any timing mentioned is hypothetical, used only to show the shape.

What Twilio is waiting for

When a call arrives on a number, Twilio sends an HTTP request to your voice URL and waits for TwiML. Until it gets a response, the caller is waiting too.

Twilio's webhook connection settings give a sense of the limits:

  • The default connect timeout is 5 seconds and the default read timeout is 15 seconds.
  • Twilio enforces a hard 15 second ceiling on call-related HTTP requests, whatever overrides you set.
  • By default Twilio retries once, on connection failures only. You can change that with a retry policy.

You can tune these per URL with connection overrides in the URL fragment, for example a shorter connect timeout so Twilio fails over to your fallback URL sooner. Twilio now describes overrides as the legacy approach and recommends its Webhooks configuration API for new setups, so check which one your account uses.

The bigger lesson: the slow part is rarely Twilio. It is whatever your workflow does before it answers.

n8n's three ways to answer

n8n's Webhook node has a Respond setting with three options.

  • Immediately. Returns a fixed "Workflow got started" message at once. Fast, but it isn't TwiML, so Twilio can't use it.
  • When Last Node Finishes. Returns the output of the last node. This is the slow pattern from the intro.
  • Using a Respond to Webhook node. Returns whatever that node sends, at the point in the flow where it runs.

The third option is the one you want. Put the Respond to Webhook node right after the trigger, return the TwiML as text with an XML content type, and let the rest of the workflow keep running. n8n's docs note that if a second Respond to Webhook node runs later, it is ignored. The response is already gone, but the workflow carries on.

Before and after, as a list of steps

Before (everything inline):

  1. Twilio posts the incoming call.
  2. n8n searches GoHighLevel for the caller's phone.
  3. n8n reads business hours from a sheet.
  4. n8n writes a call log row.
  5. n8n posts to Slack.
  6. n8n returns TwiML to connect the stream.

If step 2 takes three seconds in this made-up example, the caller waits three seconds plus everything else. If step 3 fails, the caller may never reach the agent.

After (answer first):

  1. Twilio posts the incoming call.
  2. n8n checks the Twilio signature.
  3. n8n sends back a Connect and Stream response pointing at the agent, with the caller's number and call SID attached as stream parameters.
  4. The same execution continues: GoHighLevel lookup, log row, Slack post.
  5. The lookup result is written to a fast store keyed by call SID, for example a Redis key or an n8n data table row.
  6. The voice agent reads that record when it needs caller context, a second or two into the call.

The caller reaches the agent as fast as n8n can return a small piece of text.

Passing context without blocking

Two rules from Twilio's Stream docs shape step 3.

  • The stream URL can't carry a query string. Pass values with nested Parameter elements instead. Twilio delivers them to your WebSocket server in the start message.
  • The combined name and value of each parameter must be under 500 characters.

So pass identifiers, not data. The call SID and the caller's number are enough for the agent to fetch whatever n8n stored. Don't try to cram a CRM record into a parameter.

A sample context record written in step 5, with example values:

  • key: call context for CA1234 (example call SID)
  • caller: +1 555 0142
  • GHL contact ID: found, c_88213
  • name: Dana Lee
  • open appointment: Thursday 14:00
  • tags: returning customer
  • written at: 2 seconds after the call connected

If the lookup hasn't finished when the agent asks, the agent should carry on without it and ask the caller's name. A missing record must never block the conversation.

Retries and duplicates

Twilio can retry a webhook, depending on your retry policy. If your workflow does side effects after responding, a retry means they run twice. Two log rows, two Slack posts, maybe two CRM notes.

Twilio sends an I-Twilio-Idempotency-Token header so you can tell retry attempts apart. A simple pattern in n8n:

  1. Read the idempotency token and the call SID.
  2. Try to insert them into a processed-requests table with a unique constraint.
  3. If the insert fails because the row exists, stop the side-effect branch after returning TwiML.

TwiML still goes back on every attempt, because Twilio needs an answer. Only the extra work is skipped.

After the call: status callbacks

Some work belongs after the call ends, such as writing the call outcome to GoHighLevel or sending a follow-up SMS. Use a separate workflow triggered by a status callback, not the voice webhook.

  • By default a call's status callback fires once, on completed. You can subscribe to initiated, ringing, and answered too.
  • The Stream element has its own status callback for when a stream starts and stops.

Keep these workflows idempotent too. Use the call SID plus the status as the dedupe key, so a repeated completed event doesn't create two CRM notes.

Checking the signature in n8n

Anyone who knows your webhook URL can post to it. Twilio signs each request in the X-Twilio-Signature header. By default it is an HMAC over the full URL and the posted parameters, keyed with your auth token. The Webhooks configuration API also lets you sign with a shared key you manage. Verify the signature before doing anything else. Leave any connection override fragment out of the URL you sign, because Twilio leaves it out too.

In n8n this usually means a small verification step right after the trigger. If it fails, respond with an error and stop.

Limitations

  • Answering first means the agent starts without caller context. Design the opening line to work either way.
  • n8n in queue mode adds its own scheduling delay to the background branch. Measure it if the agent depends on the context record.
  • Webhook settings differ between connection overrides and the newer Webhooks configuration API. Check which one applies before tuning timeouts.

Takeaways

  • The voice webhook returns TwiML first and nothing else blocks it.
  • Use a Respond to Webhook node early, and let the workflow continue after it.
  • Pass identifiers as stream parameters and store caller context separately, keyed by call SID.
  • Deduplicate side effects with Twilio's idempotency token and the call SID.
  • Put post-call work behind status callbacks, in its own workflow.

The webhook is only one of several places a voice agent loses time. This guide to cutting Twilio voice latency goes through the rest of the audio path, from edge placement to streaming and endpointing.

References