Pular para o conteúdo principal

Order Webhook for n8n

Um webhook seguro do n8n para pedidos de qualquer app: confere sua chave e cada pedido, salva os válidos em uma tabela de dados e responde a cada chamada. Com n8n 2.48.7 no Docker.

  • n8n
  • n8n Webhook node
  • n8n Code node
  • n8n If node
  • n8n Data table node

Capturas de tela

Captura 1 de 7: Capa do Order Webhook for n8n: a promessa, as etiquetas de tecnologia, um terminal enviando um pedido com curl e recebendo o pedido salvo, e o workflow Order webhook publicado.

Capa do Order Webhook for n8n: a promessa, as etiquetas de tecnologia, um terminal enviando um pedido com curl e recebendo o pedido salvo, e o workflow Order webhook publicado.

Pagamento único

  • ₹ 99+ GST, ₹ 116,82 no total
  • US$ 2
  • Baixe na sua biblioteca assim que o pagamento for confirmado.
  • Todas as versões futuras deste projeto estão incluídas, sem custo adicional.
Versão mais recente
1.0.0 · 21 de nov. de 2026

Visão geral

O código-fonte completo de um webhook de pedidos para o n8n. Ele só aceita chamadas com a sua chave secreta, confere o cliente, o livro e a quantidade de cada pedido JSON, salva os válidos em uma tabela de dados do n8n e responde com o pedido salvo (201) ou uma lista de problemas (400). Inclui os dois workflows, a tabela com um clique e Docker Compose com n8n 2.48.7. Testado no macOS.

Lojas, formulários e apps precisam de um lugar para enviar seus pedidos. Order Webhook for n8n entrega esse endereço pronto: um webhook que só responde a quem tem a sua chave, confere cada pedido, salva os válidos e diz a cada chamada exatamente o que aconteceu. Cada resposta abaixo foi testada em chamadas reais no macOS com n8n 2.48.7 e Docker Desktop.

O que ele faz

  • Recebe pedidos de qualquer app. Uma loja, um formulário, um script ou outro serviço envia cada pedido como JSON para http://localhost:5678/webhook/orders.
  • Só deixa entrar quem tem a sua chave. O Header Auth do n8n confere o cabeçalho X-API-Key em cada chamada. Sem chave ou com a chave errada, a resposta é o status 403 com Authorization data is wrong!, e o workflow nem começa.
  • Confere cada pedido. O cliente e o livro precisam ser texto, com no máximo 100 e 200 caracteres, e a quantidade um número inteiro de 1 a 100. Todos os problemas são listados, não só o primeiro, e os outros campos nunca são salvos.
  • Salva os pedidos válidos. Cada pedido válido vira uma linha da tabela de dados Orders, com o próprio id e o horário em que foi salvo.
  • Responde a cada chamada. Um pedido salvo volta com o status 201 e a nova linha. Um pedido com problemas recebe o status 400, nada é salvo e a resposta lista cada campo a corrigir. Um corpo que não é JSON recebe o 422 do próprio n8n.
  • Cria a própria tabela. Um workflow de configuração cria a tabela Orders e as colunas com um clique. Rodar de novo não muda nada.
  • Coloca o n8n para rodar se você precisar. O compose.yml inicia o n8n 2.48.7 no Docker, acessível só a partir do seu computador, com porta e fuso horário opcionais no .env.

Instalação

  1. Descompacte o arquivo e abra um terminal na pasta dele.
  2. Inicie o n8n com docker compose up -d. Pule este passo se você já usa o n8n 2.
  3. Abra http://localhost:5678, crie sua conta de proprietário e importe os dois workflows da pasta workflows.
  4. Rode Set up the Orders table uma vez.
  5. Crie uma chave longa e aleatória, por exemplo com openssl rand -hex 32, e salve-a em uma credencial Header Auth do nó New order, com o nome X-API-Key.
  6. Publique Order webhook e envie seu primeiro pedido.

Cada passo com capturas de tela: How to Set Up and Run the Order Webhook for n8n (abre em uma nova aba) (em inglês).

Bom saber

  • Mude as regras em um só lugar. Os limites da quantidade e do tamanho dos textos ficam no início do nó Check the order.
  • O n8n não vem incluído. O compose.yml baixa a imagem oficial do n8n, e vale a licença do próprio n8n.
  • Testado no macOS com Docker Desktop.

Aprenda como funciona

O n8n Tutorial for Beginners (abre em uma nova aba) gratuito (em inglês) ensina n8n do zero. Part 4: Webhooks: Start a Workflow from Any App (abre em uma nova aba) (em inglês) constrói a primeira versão deste webhook, How to Secure an n8n Webhook with Header Auth (abre em uma nova aba) (em inglês) explica a chave e How to Send a Custom Response from an n8n Webhook (abre em uma nova aba) (em inglês) explica as respostas.

n8n é uma marca da n8n GmbH. Docker é uma marca da Docker, Inc. Os demais nomes são marcas de seus respectivos donos.

Série de tutoriais gratuita

n8n Tutorial for Beginners

Prefere aprender construindo? Este guia gratuito e passo a passo no nosso blog mostra como o projeto é feito.

Ler a série (abre em uma nova aba)

O que você leva

Tudo o que está no arquivo, em um relance.

  • A versão 1.0.0 do código-fonte completo: dois workflows do n8n, um arquivo do Docker Compose, um exemplo de .env e um README
  • O workflow Order webhook: Header Auth no webhook, um passo que confere cada pedido, um passo que salva os pedidos válidos em uma tabela de dados e duas respostas (201 e 400)
  • Verificações que você pode mudar: cliente e livro obrigatórios, uma quantidade inteira de 1 a 100 e uma lista com cada problema encontrado
  • Um workflow de configuração que cria a tabela de dados Orders com um clique
  • compose.yml com n8n 2.48.7, privado no seu computador, com a porta e o fuso horário no .env
  • Um README com os passos de configuração, o formato do pedido, cada resposta, as opções, a solução de problemas e a limpeza

Feito com

As versões e os ambientes exatos com que foi criado e testado.

  • n8n2.48.7
  • n8n Webhook node2.2
  • n8n Code node2
  • n8n If node2.4
  • n8n Data table node1.1
  • n8n Respond to Webhook node1.5
  • Docker Compose5.7.0
  • Docker Engine29.9.3

O que há no arquivo

A árvore de pastas que você recebe ao descompactar.

order-webhook-n8n/

  • .env.example
  • .gitattributes
  • .gitignore
  • README.md
  • compose.yml
  • workflows/
    • order-webhook.json
    • set-up-orders-table.json

O que ele precisa de você

As contas e os serviços que ele espera encontrar, para nada surpreender.

  • n8n 2 rodando por sua conta (a Community Edition gratuita basta), ou Docker para rodar o n8n incluído
  • Docker Desktop no macOS ou Windows, ou Docker Engine no Linux, para usar o compose.yml
  • Uma porta livre no seu computador, a 5678 por padrão
  • Um app, formulário ou script que consiga enviar um POST HTTP com JSON e um cabeçalho

Versões

Todas as versões até agora, da mais recente para a mais antiga.

  1. 1.0.0Mais recente

    Primeira versão do código-fonte completo.

    • Um Order webhook que só aceita chamadas com a sua chave (Header Auth) e confere cada pedido.
    • Os pedidos válidos são salvos em uma tabela de dados do n8n e recebem o status 201; os pedidos com problemas recebem o status 400 e uma lista do que corrigir.
    • Um workflow de configuração que cria a tabela Orders com um clique.
    • n8n 2.48.7 no Docker com compose.yml, testado no macOS.

Source Code Licence

O que você pode fazer com ele

What you may and may not do with the source code you buy.

Ler a licença completa
  1. What this licence covers

This licence governs every file included in a product you buy from Dewiride Store: source code, configuration, database scripts, sample data, documentation and any other file in the download. It takes effect when your payment is confirmed and applies to every release of that product that reaches your library. Files that reach your library through an annual updates membership are governed in exactly the same way.

It forms part of the Terms of Sale and Use. Where a product page states different or additional licence terms for that product, those terms prevail for that product. The membership page may likewise state different or additional licence terms for the files a membership carries, and those terms then prevail for those files.

  1. The licence we grant you

We grant you a perpetual, worldwide, non-exclusive, non-transferable licence to use, reproduce, adapt, translate and modify the files, and to include the result in your own work, on the conditions set out below.

Perpetual means it does not expire. Worldwide means it is not limited to any country. Non-exclusive means we license the same product to other customers. Non-transferable means you cannot pass it on to someone else.

The licence is granted to you — either you personally, or the organisation you identified when buying. Everyone working within that organisation may use the files for that organisation’s projects. Nobody outside it may.

  1. What you may do
  • Use and change the files in your own projects, commercial or otherwise, with no limit on the number of projects.
  • Build a product or a service on them and charge your own customers for it.
  • Deploy the result for a client, as part of work you are doing for that client.
  • Distribute the result in compiled, deployed or otherwise non-source form.
  • Keep as many back-up copies as you reasonably need.
  • Study, observe and test how the code works, and obtain the information you need to make it work with your own software.

The last two are yours by law under sections 52(1)(aa) to (ac) of the Indian Copyright Act, 1957, and nothing in this licence is intended to take them away.

  1. What you may not do
  • Resell, sublicense, redistribute or publish the files themselves, in whole or in substantial part, in source form.
  • Include them in a template, starter kit, course, tutorial repository or component library that you sell or give away, where the code is the thing being supplied.
  • Share your account, your download links or your invoices with anyone outside your organisation.
  • Publish the files in a public repository, or in any other place where they can be obtained without buying them.
  • Remove or obscure the copyright and attribution notices in the source files.
  • Use the files to build something whose main purpose is to compete with Dewiride Store as a supplier of the same code.

The distinction that matters is simple: you may sell what you build with the code; you may not sell the code.

  1. Third-party components

Our products depend on open-source libraries, frameworks and services that we did not write. Those remain under their own licences, which we do not and cannot change. Where a product includes or requires such a component, its licence is named in the product’s documentation, and complying with it is your responsibility.

  1. Releases

Every release of a product you own is covered by this same licence and appears in your library at no extra cost. A release you have already downloaded remains licensed to you even if we later stop publishing the product. A release that reached your library through an annual updates membership is licensed to you on these same terms, and stays licensed after the period that carried it has ended.

  1. Ownership

We keep ownership of the files and of the copyright in them. You own whatever you create with them: your changes, your additions and the product you build are yours.

  1. If this licence ends

This licence ends if you materially breach it and do not put the breach right within thirty days of us asking you to in writing. It also ends if your payment is reversed or refunded, because the purchase it depends on no longer stands. Where a membership period is refunded or reversed, the licence ends for the releases that period carried and for nothing else: anything you bought separately, or that another period carried, is unaffected.

If it ends, you must stop using the files and delete the copies you hold. Work you had already delivered to a client before that point may continue in use, so that ending this licence never breaks something your own customer relies on.

  1. No warranty beyond the description

The warranties and limits in section 19 and section 20 of the Terms of Sale and Use apply to this licence as well.

  1. Governing law

This licence is governed by the law of India, and section 24 of the Terms of Sale and Use applies to any dispute about it. If a translation and the English version differ in meaning, the English version governs.