n8n: Respond to a Webhook Instantly and Keep the Workflow Running
Описание и применение
В n8n по умолчанию HTTP‑ответ от вебхука отправляется только после завершения всего рабочего процесса, что приводит к тайм‑ауту. Настройка режима ответа на "On Received" или использование узла "Respond to Webhook" позволяет клиенту получить быстрый 200 ответ, а остальная работа продолжается в фоне.
Задача
When a webhook triggers an n8n workflow, the HTTP response is delayed until the entire workflow finishes, causing client timeouts and poor UX.
Результат
Clients receive a 200 response within 150 ms, while the workflow continues to run heavy tasks in the background, eliminating timeouts and improving user experience.
Рабочий процесс
- Configure webhook node to use "On Received" or "Using 'Respond to Webhook' Node'" response mode
- If using "On Received", set response code 200 and optional message
- If using "Respond to Webhook", add a Code node to generate a jobId and timestamp
- Connect Code node output to a Respond to Webhook node with JSON body {success:true, jobId:…}
- Continue workflow with heavy nodes (AI, PDF, DB, Slack) after the Respond node
- Optional: attach an Error Workflow to notify on failures
- Optional: write status to DB and expose polling endpoint for final result
Доказательства
By default, n8n couples the lifecycle of an incoming HTTP request to the lifecycle of the entire workflow.
Pattern B: Generate Ticket, Respond Early, Then Continue
- Дата записи: 2026-09-15T03:01:38.551Z