Deploy WhatsApp AI Assistant — OpenAI-Powered Bot, Self-Hosted
Self-host a WhatsApp AI bot with your OpenAI Assistant. No per-convo fees.
BOT-Monoagente
Just deployed
Deploy and Host WhatsApp AI Assistant Bot on Railway
WhatsApp AI Assistant Bot is a Node.js bot that connects WhatsApp to your own OpenAI Assistant using the BuilderBot framework — automated, intelligent conversations driven by an assistant you configure, with custom flows and environment-variable setup. Scan a QR code to connect, point it at your OpenAI Assistant ID, and your WhatsApp answers customers with GPT-powered replies.
Hosted WhatsApp AI chatbots charge monthly subscriptions plus per-conversation fees. Self-host on Railway for ~$5/month plus your own OpenAI usage — an always-on AI assistant on WhatsApp with your prompts, flows, and data on infrastructure you own.
What This Template Deploys
| Service | Purpose |
|---|---|
| WhatsApp AI Assistant Bot | The Node.js + BuilderBot service — connects to WhatsApp, routes messages to your OpenAI Assistant, and returns AI replies, on the public web service |
Single-service and lightweight. Connect via QR code, set your OpenAI Assistant ID and API key, and the bot runs. Add a persistent volume for the WhatsApp session so it reconnects after restarts without re-scanning.
About Hosting WhatsApp AI Assistant Bot
Running an AI WhatsApp bot in production means a long-lived Node.js process holding the WhatsApp session, secure storage for your OpenAI key, and a public HTTPS endpoint for BuilderBot's webhooks. On a local machine that means keeping a computer on 24/7; on a raw VPS it means process managers and manual setup.
Railway keeps the bot online as a managed container with your OpenAI key injected as an environment variable and automatic HTTPS. Configure the bot entirely through environment variables — your OpenAI Assistant ID, API key, and flow settings — with no code changes needed.
Account-safety note: this bot connects a personal WhatsApp account through an unofficial library. WhatsApp/Meta detects and bans accounts that automate messaging or send bulk unsolicited messages. Use a dedicated business number you can afford to lose, message only users who initiated contact, and respect rate limits. For officially sanctioned high-volume messaging, use the WhatsApp Business API. This risk is inherent to all unofficial WhatsApp bots, not specific to this template.
Typical cost: ~$5/month on Railway's Hobby plan for the bot, plus OpenAI API usage (a few
cents per conversation with gpt-4o-mini). No per-conversation SaaS fees.
Deploy in Under 5 Minutes
- Create an OpenAI Assistant at platform.openai.com and copy its Assistant ID
- Click Deploy on Railway — the bot builds automatically (~1–2 minutes)
- Set
OPENAI_API_KEYandASSISTANT_IDin the Variables tab - Open the deploy logs, wait for the QR code, and scan it with WhatsApp
- Message the bot — it replies using your configured OpenAI Assistant
No coding. No SSH. No local machine kept running.
Common Use Cases
- Automated AI customer support on WhatsApp — answer common questions instantly with an assistant trained on your business, escalating to a human when needed
- Lead generation and qualification via chat — greet inbound leads, ask qualifying questions, and capture details automatically through conversational flows
- Intelligent notifications and reminders — send AI-personalized reminders, order updates, and follow-ups to users who opted in
- Self-hosted alternative to WhatsApp chatbot SaaS — own your bot and data instead of renting a hosted AI chatbot with monthly and per-conversation fees
- FAQ and knowledge-base bot — connect an OpenAI Assistant with your docs so the bot answers product and support questions from your own content
- Multi-flow conversational automation — use BuilderBot's flow system to branch conversations, collect structured input, and trigger actions based on user replies
Configuration
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY | ✅ Required | Your OpenAI API key — powers the assistant replies |
ASSISTANT_ID | ✅ Required | The ID of the OpenAI Assistant the bot uses (from platform.openai.com) |
PORT | ✅ Pre-set | The port BuilderBot's webhook server listens on |
numberSession | Optional | Session identifier for the WhatsApp connection |
PROVIDER | Optional | WhatsApp provider setting for BuilderBot (e.g. Baileys) |
Set
OPENAI_API_KEYandASSISTANT_IDbefore deploying — the bot needs both to function. Mount a persistent volume for the WhatsApp session so the bot reconnects without re-scanning the QR code on every redeploy. Run a single instance per WhatsApp number to avoid session conflicts. Verify exact variable names against the template repository before publishing.
WhatsApp AI Assistant Bot vs. Alternatives
| This Bot (Railway) | WhatsApp chatbot SaaS | Official Business API | Manual replies | |
|---|---|---|---|---|
| Monthly cost | ~$5 + OpenAI usage | Subscription + per-convo | Per-conversation fees | Free (your time) |
| AI-powered replies | ✅ OpenAI Assistant | ✅ Varies | ⚠️ Build yourself | ❌ No |
| Self-hosted / own data | ✅ Your instance | ❌ SaaS servers | ⚠️ Provider | ✅ Yes |
| Custom flows | ✅ BuilderBot | ⚠️ Tiered | ⚠️ Build yourself | ❌ No |
| Meta approval needed | ✅ No | ⚠️ Varies | ❌ Required | ✅ No |
| Per-conversation fees | ✅ None | ❌ Usually | ❌ Yes | ✅ None |
| Ban-risk (unofficial) | ⚠️ Real — see note | ⚠️ Varies | ✅ Sanctioned | ✅ None |
Dependencies for WhatsApp AI Assistant Bot Hosting
- Railway account — Hobby plan (~$5/month) for the bot container
- An OpenAI API key and a configured OpenAI Assistant (from platform.openai.com)
- A dedicated WhatsApp number for the bot (not your primary personal number)
Deployment Dependencies
- BuilderBot Framework — the WhatsApp bot framework this uses
- OpenAI Assistants API — configure your assistant
- OpenAI API Keys — create your API key
- Railway Documentation — deployment and variables
Implementation Details
This template deploys a Node.js bot built on the BuilderBot framework, which connects to WhatsApp and forwards messages to your configured OpenAI Assistant. On first boot it prints a QR code to the deploy logs; scanning it with WhatsApp authenticates the session, after which the bot listens for messages, sends them to your Assistant, and returns the AI replies.
Configure everything through environment variables — OPENAI_API_KEY and ASSISTANT_ID are
required. Because the WhatsApp connection is session-based, mount a persistent volume so the
session survives redeploys, and run a single instance per number since WhatsApp permits one active
session per login. BuilderBot's flow system lets you branch conversations and collect structured
input beyond simple question-and-answer.
Frequently Asked Questions
Do I need an OpenAI Assistant already set up?
Yes. Create an Assistant at platform.openai.com, configure its instructions and any knowledge
files, and copy its Assistant ID into the ASSISTANT_ID variable. The bot routes WhatsApp
messages to that Assistant and returns its responses, so the Assistant's configuration defines how
your bot behaves.
How much does it cost to run?
About $5/month for the Railway container plus OpenAI API usage. With gpt-4o-mini, per-message
cost is a fraction of a cent, so light usage typically stays low. There are no per-conversation
SaaS fees — you pay only compute and your own OpenAI tokens.
Is it safe for my WhatsApp account? There's real risk. WhatsApp bans accounts that automate messaging or send bulk/unsolicited messages. Use a dedicated number, message only users who contacted you first, and respect rate limits. Never use your primary personal number. For sanctioned high-volume sending, use the official WhatsApp Business API.
Do I lose the WhatsApp session if Railway redeploys? If you mount a persistent volume for the session data, the bot reconnects without re-scanning the QR code. Without a volume, you re-scan from the deploy logs after each redeploy.
Can I customize how the bot responds? Yes. The bot's intelligence comes from your OpenAI Assistant — edit its instructions and knowledge at platform.openai.com — and BuilderBot's flow system lets you add conversational branches, collect input, and trigger custom actions on top of the AI replies.
Can I run more than one bot on the same number? No. WhatsApp allows one active session per login, so run a single instance per number. To run multiple bots, use a separate WhatsApp number and deployment for each.
Why Deploy and Host WhatsApp AI Assistant Bot on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying WhatsApp AI Assistant Bot on Railway, you get an always-on AI assistant for WhatsApp — powered by your own OpenAI Assistant, with custom flows and full data ownership — at ~$5/month plus usage, deployed with a single QR scan and no per-conversation fees.
Template Content
BOT-Monoagente
pereyrahugor/Bot-RialWay