garofalodeveloperThiago Garofalo

WhatsApp sales bot: the ad lead reaches the sales rep already qualified

Period: November 2026 · Role: gathering the rules with sales, architecture, code, Meta integration and operations · Status: live since 2026-11-14; first real customers on 2026-11-15

In one sentence: Acoplin’s Meta ads brought conversations that I answered by hand, always with the same questions; now a bot asks those questions, checks the company with the Federal Revenue and hands me an order ready to quote, and the first real customer reached a qualified order in 4 minutes without anyone touching the phone.

1. Context and problem

Acoplin makes and sells industrial hoses, couplings and clamps. Its click-to-WhatsApp ads on Meta work: they bring conversations every day. The problem was on our side.

The rule that shaped the project: the bot qualifies, it does not quote. Price depends on the price list (retail or reseller), payment terms for new customers, freight and stock. That stays a human decision. The bot delivers everything the person needs to quote in minutes.

2. Results

Indicator Value
From decision to bot live 1 day (2026-11-14)
First real customer from an ad less than 1 hour after the bot was finished
Time from the first customer’s message to a qualified order 4 minutes
Promised to the customer a quote within 1 hour during business hours
Test suites 5 (flow with 28 cases, WhatsApp, deadlines, login and email)

On the first day, two people came from the ads. One answered everything and became an order with a protocol number: product, size, length, tax ID and delivery, with no human involved. The other stopped at the quantity question, and the panel shows exactly where.

3. How it works for the customer

flowchart LR
  AD[Ad on<br/>Instagram or Facebook] --> WA((Bot's<br/>WhatsApp))
  WA --> Q[Quote questions<br/>only the missing ones]
  Q --> DOC[Tax ID checked<br/>with the Revenue]
  DOC --> P[Order with protocol<br/>and 1-hour deadline]
  P --> BT[Button: talk<br/>to the sales rep]
  BT --> C((Sales rep's<br/>WhatsApp with the<br/>order written))
  P --> MAIL[Email to the rep<br/>with a quoted shortcut]
  Q -. discontinued .-> END[Polite answer<br/>and close]
  Q -. special case<br/>or asked for a person .-> C
  1. The customer clicks the ad and sends the first message. If the text or the ad itself already says the product, the bot skips questions.
  2. The bot asks only what is missing: application, pressure or pump, size, length (rounded to a full roll or length), splice and clamp, material, fitting, quantity.
  3. It asks for the company tax ID (CNPJ), looks it up with the Federal Revenue and shows the company name for the customer to confirm. Individuals are served too.
  4. It creates the order with a protocol number and sends a button that opens the sales rep’s WhatsApp with the order already written. The customer starts the conversation with the main number, so there is no message cost and no approved template.
  5. The sales rep gets an email with the summary, the promised deadline and a shortcut to mark it as quoted.

At any time, “consultor” hands over to a person with everything answered so far, and “menu” starts over. Audio and photos do not break the conversation. Special requests, such as drip irrigation and fire fighting, go straight to the sales rep.

4. Architecture

Part How it works
Webhook Meta calls the route; the HMAC SHA-256 signature is checked in constant time against the app secret, 200 is returned at once and processing happens afterwards. Each Meta message id is unique in the database, so a redelivery never produces a double reply
Flow as a pure function It takes the conversation and the input and returns the next state and the actions (text, buttons, list, link, look up the tax ID, create the order). No database, network or hidden clock. The 28 test cases walk the paths in milliseconds
Product rules Written with sales before the code and versioned: which product for each pressure range, what to ask for each line, what is discontinued and when to call a person. Sizes and rolls come from the website catalog
Source ad Meta sends the ad the conversation came from. The bot uses it to skip questions and stores it for the per-ad funnel
Tax ID Three public sources in sequence, so the lookup does not fail together with one of them
Deadline Monday to Friday, 8 a.m. to 5 p.m. If a full hour fits before closing, it promises 1 hour; otherwise, the next business hour. Fifteen minutes before it expires, an email alert goes out for orders not yet quoted
“Quoted” link Signed with HMAC and valid only for that order. It opens a page with a confirm button, because email scanners open links on their own and a GET must not change anything
Panel Login with two-factor authentication. Orders (quoted, lost, reopen), conversations (take over, hand back, reply from the bot’s number) and indicators per ad: arrived, asked for a quote, asked for a person, discontinued item and stopped midway

5. Engineering decisions

6. Lessons

7. Next steps

  1. Switch the number in every ad and measure the cost per qualified order, not per conversation.
  2. Phase 2: register the customer in the ERP from the tax ID and leave a draft quote so the sales rep only checks price and terms.
  3. Transcribed audio instead of asking for text, and AI to understand the free text that today goes to the sales rep.

8. Stack

Next.js 16 · TypeScript · Drizzle ORM · PostgreSQL 16 (PGlite in development) · WhatsApp Cloud API · Amazon SES · Docker Compose · Caddy · Oracle Cloud in São Paulo.

The code is private. This case study describes the design and results without customer data.