Editorial

AI agent on WhatsApp on a Hostinger VPS: how I built mine

I built an AI agent that answers on WhatsApp on a Hostinger KVM 2 VPS. I cover what I installed, what failed, how much it weighs on the server and the risk of a banned number.

Bruno Luiz15 min read
Read this content in other languages:
Editorial transparencyI have used the Hostinger VPS since February. Purchases with SONAR20 or through the link may earn me a commission, at no extra cost to you.Read more

I have used the Hostinger VPS since February. Purchases with SONAR20 or through the link may earn me a commission, at no extra cost to you.

Hostinger code

20% off

SONAR20
Copy and go to the store

The code stays copied: just paste it at checkout.

Cover with the Hostinger logo, the text «AI agent on WhatsApp on a VPS», the SONAR20 code and an illustration of a cloud server connected to a green chat bubble, with a small robot reading a tablet beside it.

Quick answer

It can be done: the Sonar de Ofertas assistant has run since August on a Hostinger KVM 2 VPS and answers on WhatsApp. With the 20% from , the 24 months come to $168.77 in the cart on the global site. The WAHA connection is not WhatsApp's official one, and the number can be banned: the "Will it get banned?" chapter weighs that risk.

A conversation with the agent

In a test conversation, I wrote "Tem air fryer até 300 reais?" ("Any air fryer up to 300 reais?") and the agent showed ten options within the budget, with the store and discount of each. I replied "1" and got the card for the first one, with photo, price and link.

Test conversation, in Portuguese, with the Sonar de Ofertas assistant. Prices are those at the time of the test.
The card that arrives after choosing option 1.

Swipe to see more · 2 photos

The one answering is the shopping assistant of Sonar de Ofertas, my deals and coupons site. It is an AI agent that I built and that runs on a Hostinger VPS, a rented virtual server with processor and memory reserved for me, next to n8n, the site's automation tool.

What the agent does

On WhatsApp, the agent does what the site does in search: it finds the deal, shows the coupon and warns when the price drops. It has 25 functions. The main ones:

  • look up a deal, with a price cap, and show the card of the chosen item;
  • show a product's price history;
  • create a price alert and a wish list;
  • show a store's coupons and the new coupons;
  • turn a store link (Amazon, Mercado Livre, KaBuM, Shopee, Magalu and others) into an affiliate link, short links included;
  • understand audio: the person speaks, it transcribes and replies as if it were text.
The coupons function replies with the link to the store's coupons page.

The AI understands the request, and the code fetches the price and link from the site's catalog. When someone writes "quero uma air fryer até 300 reais" ("I want an air fryer up to 300 reais"), the AI only separates the product and the cap; the price, link and stock in the reply come from the catalog.

The code and the automated tests were written with AI coding agents (Claude Code, Codex and Muse), and a second agent reviewed the changes. What stayed with me were the decisions: what the agent can do, in what order each piece goes in and the OK for each version to go live. The tests on real WhatsApp were mine too. In almost four months there were 709 saved changes to the code (commits), about 70 thousand lines with no npm library and 356 test files. If you build yours this way, keep the final test on your own WhatsApp for yourself.

How a message arrives and comes back

There are four steps, and only WAHA, the free program that links a WhatsApp number to your code, talks to WhatsApp.

A message's path through the agent.
  • The number. A WhatsApp Business, with WAHA joining as a "linked device", the same way WhatsApp Web joins your account.
  • WAHA. It receives the message and notifies the agent through a webhook (an automatic notice between the two programs), signed and over the server's internal network.
  • The agent. It checks that the notice really came from WAHA, goes through the safeguards (bot talking to bot, consent, commands such as "cancelar" ("cancel") and "menu") and, when it is free text, asks the AI what the person wants. The AI returns the fields in a fixed format, checked by a schema (the template that says which fields the reply must have). Only then does the code run the search, the coupon or the alert and build the reply, with text and card.
  • The way back. WAHA sends the reply to the person.

The pieces you do not write are WAHA and the AI. The rest is yours: the safeguards, the conversation with the AI and what the agent does with the reply.

The VPS I use and how much it handles

On my KVM 2, with one WhatsApp session connected, the agent and WAHA together use less than 1 GB of the 8 GB of memory.

I use it: the VPS has been mine since February, and the agent has run on it since August. I created the machine with the Ubuntu 24.04 with n8n template, which already includes Docker, the program that runs each service in a separate box, the container. Besides the agent and WAHA, it runs n8n, a dashboard and the deal collectors.

VPS KVM 2
8 GBof memory, 2 vCPU and 100 GB of disk
Agent
70 MBabout that, with a 256 MB limit
WAHA
800 MBabout that, with a 1 GB limit
Minimum WAHA recommends
4 GBand 2 CPUs

Memory measured with one WhatsApp session, on the same day as the price reading.

The heavy piece is WAHA: the agent uses less than a tenth of its memory. By the minimum WAHA itself recommends, the KVM 1, with 1 vCPU, falls short; the KVM 2 is the first plan that meets it. If your automation will live on n8n, n8n on Hostinger compares the managed plan with the VPS.

Hostinger VPS, 24 months
PlanResourcesMonthly equivalent24-month totalRenews per month
KVM 11 vCPU, 4 GB, 50 GB$6.49$155.76$11.99
KVM 22 vCPU, 8 GB, 100 GB$8.79$210.96$14.99
KVM 44 vCPU, 16 GB, 200 GB$12.99$311.76$28.99

Prices from the global site's storefront, in US dollars, read on December 5, before the coupon. In the global site's cart, read on November 29, took $42.19 off the KVM 2, and the total for the first 24 months came to $168.77. These are promotional first-period prices.

I chose the VPS because I can run WAHA, the agent and n8n on the same machine. On Hostinger's managed apps, a plan runs only one app, and was not accepted in the cart. If you are still deciding between your own server and shared hosting, VPS or shared hosting does that math by scenario.

Evolution API or WAHA: what I tried

I started with Evolution API and ended on WAHA, which is what runs to this day.

In July, the plan was Evolution API in Docker on the VPS. I even prepared it, with the version pinned, and did not go ahead with it. In August, I tested two versions of Evolution Go. One left connections open on the database. The previous one stayed stable for 15 minutes, but when it came to pairing the number it gave an outdated-client error and did not generate the QR. The same day, I switched to WAHA, in the Core edition, which is free, with the GOWS engine (the engine is the part of WAHA that talks to WhatsApp, and GOWS is the lightest of them).

Hostinger offers both paths in one click, in the VPS application catalog: WAHA, with the NOWEB engine, and Evolution API, which already comes with a database and cache and talks to n8n. I installed WAHA by hand, with GOWS. If you are starting today, the ready-made template saves the installation; the lesson from my case is to pair a test number before writing a single line of the agent.

Installation, in the order I did it

I installed one piece at a time and only moved to the next after seeing the previous one work, before opening the agent to the public.

  • The VPS, with the template that already includes Docker and the proxy with HTTPS. The proxy is the only web service open to the internet; WAHA and the agent stay inside the server only.
  • WAHA, still without a number. One container with the GOWS engine and the image pinned to a version, the port open only inside the server, a 1 GB memory limit and automatic restart. It ran for more than an hour with no session at all.
  • WAHA configuration. The names are in the box below.
  • Pairing. One QR only, the session (the connection of the number to WAHA) active for half an hour and no message sent.
  • The first send, to a test group: a card with an image, checked on the phone.
  • The agent, in its own container, with no open port. WAHA notifies the agent through the signed webhook, and the agent only accepts notices that come from inside the server. Before connecting the agent to WhatsApp, I simulated the message exchange.
  • Gradual release: first the test group and one user, then everyone.
WAHA settings I use+

WHATSAPP_DEFAULT_ENGINE: the WhatsApp engine. Mine is GOWS. Without this line, WAHA uses WEBJS, which opens a browser and is heavier.

WAHA_API_KEY: the key that protects WAHA's API.

WAHA_WORKER_RESTART_SESSIONS: restarts the sessions that were running when WAHA restarts. It already comes on.

WHATSAPP_RESTART_ALL_SESSIONS: when the container comes back, it also starts the sessions that had been stopped. It comes off; this is what fixed my reboot.

WAHA_PRINT_QR, WAHA_DASHBOARD_ENABLED and WHATSAPP_SWAGGER_ENABLED: turn on or off the QR in the log, the dashboard and the API documentation. I leave all three off.

TZ: the container's time zone. Without it, UTC applies.

Today, each new version of the agent is built on the VPS itself. A script saves the configuration, switches the version, checks that it came up and, if something fails, rolls back to the previous one on its own. The agent is down for about 10 seconds.

Before opening the agent to the public, check these points, which hold for any installation:

Minimum security before opening the agent

0 of 5 checked
  • Does WAHA's API answer only from inside the server?
  • Is the WAHA API key stored already hashed (SHA-512), as the documentation recommends?
  • Is the webhook between WAHA and the agent signed?
  • Are the Docker images pinned to a version?
  • Is no key written in the code?

How I connected the number

Use a number only for the agent: if it gets banned, your everyday WhatsApp carries on.

Mine is a WhatsApp Business on a phone. WAHA joins as one more linked device of that number, and the phone must keep the number active. Today I pair by code, not by QR: when I changed numbers, the QR expired before I could scan it, and the 8-character code worked the first time. On the phone: Linked devices, Link a device and, on the camera screen, Link with phone number instead. The code is requested from WAHA through the API, or through the dashboard, for those who leave it on.

Logout and a server restart both drop the connection. Today only the restart resolves itself.

  • Logout. When I changed phones, the session dropped, and only a new pairing fixed it. Restarting WAHA is not enough.
  • Server restart. Hostinger restarted the machine during maintenance, and WAHA came back with the session stopped: it was 1 h 53 min without answering until someone noticed. The fix was one line of configuration, WHATSAPP_RESTART_ALL_SESSIONS, which restarts the sessions when the server comes back.

Since then, a watchdog checks the session every minute and, if it drops without a logout, restarts it on its own, up to three times a day. A logout still needs a person.

Which AI understands the message: from free to Claude Haiku

Today, the one that reads each free-form sentence first is a paid model, Claude Haiku 5.5. The free ones stay in reserve and keep the smaller tasks, such as ordering the search and transcribing audio. I started with only the free ones, and in my tests they either hit the quota or returned the answer in a format the agent could not use.

What I looked at in each test was whether the answer came back in the format the code understands. The agent always needs that, because the code only runs what passes the check. Mistral and Cloudflare went through the same batch of 47 requests.

Models I tested
ModelTypeWhat happenedWhere it ended up
Gemini (Google)free30 failures in a row from the requests-per-minute limit; cap of 500 requests per day per model, on each accountreserve, and transcribes the audio
Mistralfree47 of 47 requests with a quota error; with Ministral 3B, 15 of 47 answers outside the format; then, balance exhausted twicereserve
Cloudflare Workers AIfreewith the Granite model, 39 of 47 answers outside the formatreserve, with Llama 3.1 8B
Claude Haiku 5.5 (Anthropic)paidin a product-classification test, right format in all 85 answers and right category in 72 of 74first in line

The Haiku test was about classifying products, not conversation. It counts here because it also checks the format. That is why the free ones became reserves: they step in when the paid one fails. OpenRouter and Groq, which I also tested on the free tier, were left out for instability, and the free tier of OpenRouter's large models ended in July.

I put a cap on the paid one: 30 requests per minute and 900 per day. Anthropic's API is billed separately from the Claude subscription. My plan, Ultra, includes a monthly API credit, and the agent's usage comes out of it, along with that of other projects. Without that credit, the API is pay-as-you-go, in the Anthropic Console.

Conversations pass through the AI providers: Anthropic, which understands each message, and Google, which transcribes the audio and helps order the search. Mistral and Cloudflare come in as reserves. The text of who is chatting does not go into the agent's logs, where the contact appears only as a scrambled code (hash). The agent's database stores each person's WhatsApp identifier, through which the price alert arrives later, and the profile name. It only stores these data after the person agrees, and a command in the conversation itself erases everything.

You can start on the free tier to test. To serve the public, count on a paid model in front and a daily cap on it.

What went wrong, and what I changed

Almost everything that went wrong came from three things: assuming it worked without testing with real data, the server restart, and two pieces writing to the same place at the same time.

What went wrong
What happenedWhat I changed
Audio broke: the container did not have ffmpeg, the program that converts audioffmpeg in the image, with a pinned version
WAHA delivered the message but took more than 30 seconds to confirm, and the system thought it had failed and stopped sendinga delay became "uncertain", not "failed"
Docker's automatic cleanup deleted the reserve version, the one used to roll backthe cleanup spares the project's images
Two parts wrote to the database at the same time, a row locked and set off a false alarmthe database waits for the other write to finish
Another bot started chatting with mine: 210 messages in a daya per-contact safeguard: 20 replies in 5 minutes, or the same text 3 times in 10 minutes, mean 2 hours of silence for that contact
Anthropic's API rejected the response template, and every conversation fell to the reserve without warningtemplate fixed
In the short-words test, "tv lg" found 21 offers and showed 2: the search did not link "tv" to "Smart TV""tv" now also matches "Smart TV"

The reserve list seemed to work because the first AI hid the others' defects; only testing each one alone, with a real message, showed the problem. Before opening to the public, restart the server and see whether the agent comes back on its own.

Will it get banned? The risk and the official route

It can: WAHA connects through the same path as WhatsApp Web, and WhatsApp's terms do not allow that use.

WAHA itself warns that it has no affiliation with WhatsApp and does not guarantee that the number will not be banned (WAHA documentation). The WhatsApp terms forbid accessing the service by automated means without authorization. Evolution and the other tools of this kind follow the same path.

The precautions that hold for any agent like this:

  • a number only for the agent, with a plan B if it goes down;
  • a number warmed up beforehand, with normal use;
  • never write to someone who did not write first;
  • vary the text and the interval of messages.

The last two are the ones WAHA itself recommends.

The official route is the WhatsApp Business Platform, from Meta, billed per message, with a rate that changes by country and message type. If the number is a company's main one, serving customers every day, that is the route I would take.

Who should build an agent like this

Worth it if you want your own assistant and accept looking after the server; if WhatsApp is your company's main channel, no.

You have a site or a channel and want your own assistant: it fits, and the KVM 2 is the plan I use.

You only want a ready-made personal assistant: OpenClaw, an AI assistant that Hostinger delivers already installed on the managed plan, solves it with no server to look after.

You serve customers on the company's main number: stay on the official route.

The first send is only the beginning. What takes an agent like this down is the restart (of the server or the container), the logout on the phone and the free AI at peak hours: test all three before publicizing the number.

"It was worth it for me. When something breaks, I know where to look, and I would not have that with a ready-made service. In return, the maintenance is mine, and so is the risk of losing the number."
Bruno Luiz

SONAR20 coupon and renewal

gives 20% on the first period of a new VPS purchase. Enter the code in the cart, in the "Have a coupon code?" field, or come in through the plans link, and check the total before paying.

Renewal is charged at the list price, which is in the table, and in the KVM 2 cart it comes billed every 24 months. The Hostinger coupon page has the code's step by step, and Hostinger renewal explains what happens when the plan expires.

Buy it if

  • you want your own assistant on WhatsApp and accept looking after the server.
  • you use a number only for the agent and accept that it can be banned.

Skip it if

  • the number is your business's main one: then the way is WhatsApp's official route.
  • you do not want maintenance: a logout needs someone nearby, and the server needs updates and watching.

Frequently asked questions

Do I need a VPS, or does it run on shared hosting?+

You need a VPS: WAHA runs in a Docker container, which needs administrator access to the server. The VPS chapter shows how much it takes up.

Which VPS plan is enough for a WhatsApp agent?+

The KVM 2 meets the minimum WAHA recommends and is the plan I use; the VPS chapter compares the plans.

Can I build an AI agent on WhatsApp for free?+

WAHA is free, and the VPS has a cost. In my case, Haiku, which is paid, reads the messages first, and the free ones stay in reserve.

Do I need a separate WhatsApp number?+

It is not mandatory, but I recommend it: the number can be banned, and the agent joins as a linked device of a phone that keeps the number active.

What is the Hostinger coupon code?+

, with 20% on the first period of a new purchase, VPS included.

Shopping at Hostinger

Hostinger code

20% off

SONAR20
Copy and go to the store

The code stays copied: just paste it at checkout.

Valid for
New purchases of Hostinger plans, for new and existing customers, on 12-, 24- and 48-month terms; on 1-month plans it depends on the plan;…
Stacks with other promotions?
Works on top of Hostinger's sale price (in our December 1, 2026 test, the 20% came off the Cyber Week price); stacking with other coupons…
Validity
Coupon active while the partnership runs

Hi, I’m Cecília

I share what I try at home and the codes from the stores I partner with.

Meet Cecília

Hi, I’m Bruno

Cecília’s husband and the other half of Em Casa, behind the camera and the computer.

Share:

Related articles

View all

Contents

1 of 14

Hostinger code

SONAR20
Go to the store