This guide walks you through a complete first-time installation of the n8n WhatsApp AI Agent platform on a fresh Ubuntu 24.04 LTS VPS. By the end you will have all seven services running behind HTTPS, the n8n workflow imported, and a webhook registered in Chatwoot ready to receive real WhatsApp messages. Before you begin, confirm you have shell access to the target server and that you hold active credentials for Meta (WhatsApp Cloud API), OpenAI, and Google Drive.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DevMauricio03/n8n-whatsapp-ai-agent/llms.txt
Use this file to discover all available pages before exploring further.
Confirm requirements
Verify that your server and accounts meet the minimum requirements before proceeding.Server
Network and DNS
| Resource | Minimum |
|---|---|
| CPU | 2 vCPU |
| RAM | 4 GB |
| OS | Ubuntu Server 24.04 LTS (or compatible) |
| Runtime | Docker Engine + Docker Compose v2 |
- Two public domains with A/AAAA records pointing to the server’s IP address.
- Firewall rules allowing inbound traffic on ports
22(SSH),80(HTTP), and443(HTTPS).
- Meta WhatsApp Cloud API — approved Business account, Phone Number ID, and Graph API token.
- OpenAI — API key with access to chat completions and Whisper.
- Google Drive OAuth2 — service account or OAuth credentials with read access to the data spreadsheet.
Prepare the server
Update all system packages and install the required tooling.Install Docker Engine from its official repository or through your organisation’s approved procedure, then verify both components are present:
Avoid running application services as
root. If you add your user to the docker group, be aware that group membership grants elevated privileges over the host.Clone the repository
Clone the project to your server and change into the repository root, which is the working directory for all subsequent commands.
Configure environment variables
Copy both template files to their active names:Open
After editing, confirm that no unfilled placeholders remain:Also review
.env in your preferred editor and replace every placeholder with a real value. The fields that require attention are:| Variable | What to supply |
|---|---|
N8N_DOMAIN | Your public n8n domain, e.g. n8n.yourdomain.com |
CHATWOOT_DOMAIN | Your public Chatwoot domain, e.g. chat.yourdomain.com |
LETSENCRYPT_EMAIL | Email address for Let’s Encrypt certificate notifications |
POSTGRES_PASSWORD | Long random password for the PostgreSQL superuser |
REDIS_PASSWORD | Long random password for Redis authentication |
N8N_ENCRYPTION_KEY | At least 32 random characters used to encrypt n8n credentials |
CHATWOOT_SECRET_KEY_BASE | Long random secret for Chatwoot session signing |
WHATSAPP_PHONE_NUMBER_ID | Phone Number ID from the Meta developer dashboard |
GOOGLE_DRIVE_SOURCE_FILE_ID | File ID of the Google Drive spreadsheet used as data source |
docker/docker-compose.yml to confirm image tags match the versions you have validated.Configure DNS
Create two DNS records pointing to your server’s public IP address:Replace Caddy requires public access on ports 80 and 443 to obtain and renew TLS certificates automatically via ACME. Proceed only once both hostnames resolve to the correct IP.
example.com with your real domain. After the records propagate, verify resolution from the server:Validate the Compose configuration
From the repository root, render the final Compose file and confirm there are no syntax errors, undefined variables, or missing image tags:Do not proceed if the output contains empty variable values, YAML errors, or image references that cannot be resolved.
Start all services
Bring up the entire stack in detached mode:Check that every container reaches a healthy or running state:On the first run, Docker creates three PostgreSQL databases (
n8n, chatwoot, and agent) using the init scripts in docker/initdb/. These scripts do not re-execute against an existing volume.Review service logs
Inspect the startup output of each service to catch early errors before configuring the application layer:Confirm that PostgreSQL reports all three databases are ready, that
chatwoot-prepare completes its migration without errors, that n8n is listening on port 5678, and that Caddy has issued TLS certificates for both domains.Initialise applications
ChatwootOpen
https://CHATWOOT_DOMAIN in your browser, create the administrative account, and configure a WhatsApp inbox by following the official Chatwoot documentation. Record the inbox identifier — you will need it when configuring the webhook in Step 11.n8nOpen https://N8N_DOMAIN, create the owner account, and add the following credentials under Settings → Credentials:| Credential type | Connection detail |
|---|---|
| OpenAI | Your OpenAI API key |
| PostgreSQL | Host postgres, database agent, user and password from .env |
| Redis | Host redis, password from .env |
| WhatsApp Business Cloud | Phone Number ID and API token from Meta |
| Google Drive OAuth2 | OAuth client or service account credentials |
Import the workflow
In the n8n editor, import the sanitised workflow file:After importing, complete the following before saving:
- Confirm the workflow is deactivated.
- Assign every credential to the corresponding node.
- Resolve any nodes flagged with an error indicator.
- Replace placeholder product names, prices, and URLs with your approved business information.
- Verify that the webhook node shows the production URL (
/webhook/) and not the test URL (/webhook-test/). - Run manual test executions for each major branch of the workflow.
Configure webhooks
Chatwoot must forward conversation events to the n8n production webhook. In Chatwoot, add the following URL as an integration webhook:Also register the webhook URL in the Meta developer dashboard for your WhatsApp application and document the following in your team’s operations inventory:
- Meta application ID and name
- WhatsApp Business Account ID
- Phone Number ID
- Webhook URL and subscribed events
- Chatwoot inbox identifier
- Responsible owner and credential rotation schedule
Validate database tables
Confirm that the The output should list at least the tables used by the workflow for business data and conversational memory. If the table list is empty, review the logs from the
agent database contains the expected tables created by the init scripts:postgres container and check the init scripts in docker/initdb/.Activation checklist
The workflow must remain deactivated until every item on this checklist is complete.
- Execute the full test plan from
docs/pruebas.mdand confirm all acceptance cases pass. - Review and implement the hardening measures in
docs/seguridad.md. - Take an initial backup of all Docker volumes.
- Perform a complete restore from that backup to validate the recovery procedure.
- Configure basic uptime and disk-space monitoring.