Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

About

Production-ready WhatsApp Business autoresponder powered by cloudgpu.app + DeepSeek-V4. One-click deploy to Railway / Fly.io, pay in USDT. No Western credit card needed.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

cloudgpu-whatsapp-starter

A production-ready WhatsApp Business autoresponder, powered by cloudgpu.app + DeepSeek-V4. Built for small businesses in markets where Stripe-based AI subscriptions keep getting declined.

Deploy on Railway Deploy to Fly.io License: MIT

What this is

Most small businesses in Indonesia, Vietnam, Brazil, Mexico, Nigeria, the Philippines, and Türkiye sell on WhatsApp. The 24/7 inbound message volume is the bottleneck — every late-night "is this in stock?" needs an answer or the customer goes to a competitor. The going SaaS solution (ManyChat, Wati, Respond.io with AI add-on) starts around US$40/mo, billed in USD via Stripe — and that's before the AI tokens.

This repo is the open-source minimum:

  • WhatsApp Business Cloud API (free tier from Meta — 1000 conversations/month at no cost)
  • Node.js, ~400 lines, zero database, deploys to Railway / Fly.io / any container host in 5 minutes
  • AI brain via cloudgpu.app (USDT-paid, no credit card needed) — DeepSeek-V4-Flash by default, but works with any OpenAI-compatible endpoint
  • Editable faq.yml so the shop owner controls the bot's answers without touching code
  • Detects business hours and language, polite off-hours templates, products catalog

Typical operating cost for a busy single-location boutique on WhatsApp: US$3-8 per month (mostly DeepSeek tokens), paid in USDT.

How it works

Customer sends WhatsApp message
            ↓
Meta WhatsApp Cloud API
            ↓
Your deployment (Railway / Fly / etc.) — receives webhook
            ↓
   ┌─────────────────────────┐
   │  router.js              │
   │  1. Non-text? polite no  │
   │  2. FAQ keyword hit? →   │   ← cheap, $0
   │     reply directly       │
   │  3. Else AI fallback →   │   ← DeepSeek-V4 via cloudgpu.app
   │     send to AI provider  │     (~$0.0001 per message)
   │  4. Off-hours? prepend    │
   │     template              │
   └─────────────────────────┘
            ↓
WhatsApp Cloud API (send back)
            ↓
Customer receives reply (typically 2-4 seconds total)

Quick deploy — Railway (recommended for first-timers)

  1. Click the "Deploy on Railway" button at the top of this README.
  2. Connect your GitHub and fork this repo so you can edit faq.yml later.
  3. Set the 5 required environment variables (see "Environment variables" section below).
  4. Railway gives you a public URL like cloudgpu-whatsapp-starter-production.up.railway.app. Save it.
  5. Follow the "Meta side setup" walkthrough to point WhatsApp at your URL.

Total time if you have a Meta Business Manager account: 10 minutes. If you don't: 30 minutes (Meta's identity verification takes most of it).

Quick deploy — Fly.io

# install flyctl: https://fly.io/docs/hands-on/install-flyctl/
fly launch --no-deploy   # creates app, edits fly.toml with unique name
fly secrets set \
  WHATSAPP_TOKEN=EAAxxxxx \
  WHATSAPP_PHONE_NUMBER_ID=123456789 \
  WHATSAPP_VERIFY_TOKEN=$(openssl rand -hex 16) \
  OPENAI_API_KEY=cgw-sk-xxxxxxxxxxxxxxxxxxxx
fly deploy
fly status                # grab the public hostname

Then proceed to "Meta side setup" below.

Environment variables

Copy .env.example to .env for local dev, or paste these into your hosting provider's env panel:

Variable What it is Where to get it
WHATSAPP_TOKEN Permanent system-user access token from Meta Meta Business Manager → System Users → Generate Token
WHATSAPP_PHONE_NUMBER_ID Numeric ID of your WhatsApp Business number Meta Business Manager → WhatsApp → API Setup
WHATSAPP_VERIFY_TOKEN A random string you invent Use openssl rand -hex 16 or any unique value
OPENAI_API_KEY Bearer key for the AI provider cloudgpu.app/api/console — starts with cgw-sk-
OPENAI_BASE_URL OpenAI-compatible endpoint root Default https://cloudgpu.app/v1 works. Override to use any provider.

Optional:

Variable Default Notes
AI_MODEL deepseek-v4-flash Try deepseek-v4-pro for more nuanced replies (3× cost)
AI_MAX_TOKENS 400 Max length of generated reply. WhatsApp accepts up to 4096 chars.
PORT 3000 Server port. Railway / Fly set this automatically.

Meta side setup (the part that's not us)

This walks you through getting WhatsApp Cloud API access. If you've never used Meta Business Manager, plan for 30 minutes including identity verification.

  1. Create a Meta Business account at business.facebook.com. Verify your business — Meta accepts most utility bills, tax docs, or bank statements.
  2. In Business Manager, open WhatsApp → "Add" → "API Setup". You'll get a test phone number ("from" number) for free. To use your own number, you'll need to remove it from the consumer WhatsApp app first; or just use the test number for now.
  3. Generate a permanent access token: Business Manager → System Users → Add (give it admin role on the WhatsApp asset) → Generate Token → choose whatsapp_business_messaging + whatsapp_business_management permissions, no expiration. Save the token — Meta shows it once.
  4. Copy the Phone Number ID from the WhatsApp API Setup page. It's the long number under your test/business number.
  5. Configure your webhook: API Setup → Configuration → Edit. Paste:
    • Callback URL: https://your-deployed-url.example/webhook
    • Verify token: the random string you put in WHATSAPP_VERIFY_TOKEN
    • Subscribe to: messages (just that one)
  6. Test: send a WhatsApp message to your test number from your phone. Within a few seconds the bot should reply with either a FAQ match or an AI-generated answer.

If verification fails: your deployment URL must be reachable, return 200 on GET /webhook?hub.verify_token=...&hub.challenge=...&hub.mode=subscribe. Check your hosting provider's logs.

Customize: editing faq.yml and business.yml

These two files are where the shop owner (or their developer friend) configures everything. No code changes needed. Edit on GitHub directly via the web UI, push, your deployment auto-redeploys on the next commit.

faq.yml — known answers

Each entry has keywords (a list of trigger words) and answer. If a customer message contains enough keyword overlap, the bot replies with answer verbatim — no AI call, no cost. About 60-80% of small-business messages are repeat questions (shipping, sizing, payment, returns) so this layer alone is huge.

faq:
  - keywords: ["shipping", "deliver", "delivery"]
    answer: "We offer free shipping on orders over $50. Standard takes 3-5 days."

Edit liberally. The bot reloads on next deployment.

business.yml — identity and rules

name: "My Boutique"
description: "Handmade silk scarves and modest fashion. Designed in Jakarta."
brand_voice: "warm and slightly informal — like a knowledgeable friend"
timezone: "Asia/Jakarta"
hours:
  monday: "09:00-21:00"
  ...
  sunday: closed
off_hours_template: |
  Thanks! Our team is offline; I'll help with general questions and we'll
  follow up in the morning.
products:
  - name: "Silk scarf, hand-painted"
    price: "Rp 380,000"
    url: "https://myboutique.id/p/silk-scarf"
    summary: "100% silk, 35×140cm, 12 colorways"

The AI uses this whole file as context for ad-hoc questions, so it sounds like a team member, not a generic chatbot.

Why cloudgpu.app as the AI provider

The bot will work with any OpenAI-compatible AI endpoint — that's the design. The default is cloudgpu.app/v1 because:

  • USDT payment, no Visa needed. For small business owners in CN, SEA, Latam, Africa whose cards keep getting declined on OpenAI's Stripe checkout, this is the only practical path. Top up $5 in USDT, you're good for ~2 months of moderate use.
  • DeepSeek-V4 is roughly GPT-4o quality on most business-text tasks at 1/10 the price. Math: at 200 tokens in + 100 tokens out per message, $1 of DeepSeek-V4-Flash covers ~17,000 messages. That's a year of replies for a small shop.
  • OpenAI-compatible, no lock-in. Set OPENAI_BASE_URL=https://api.openai.com/v1 to swap to OpenAI direct, or use https://api.deepseek.com to pay DeepSeek directly if Stripe works for you. Same code.

You get $0.60 free signup credit on cloudgpu.app — enough to wire this up, send a few hundred test messages, and confirm it works before topping up.

Sign up at cloudgpu.app/api/console →

Cost estimate

Realistic per-customer-message cost on default settings:

Scenario What happens Cost
Message hits a FAQ keyword Bot replies from faq.yml directly $0.00
Message goes to AI DeepSeek-V4-Flash, ~200 in + 100 out tokens ~$0.0001
WhatsApp Cloud API send Meta free tier covers 1000 conversations/month $0.00 within free tier

For a busy shop receiving 500 customer messages a month with maybe 60% needing AI: ~$0.03 in AI tokens. Add Meta's per-conversation pricing if you exceed 1000 conversations.

This is structurally cheaper than any managed alternative we're aware of. Most of your operational cost is the hosting (free on Fly.io's hobby tier, $5/mo on Railway), not the AI.

Local development

git clone https://github.com/mrhy7176/cloudgpu-whatsapp-starter
cd cloudgpu-whatsapp-starter
cp .env.example .env
# Edit .env with your real values
npm install
npm run dev

In another terminal, simulate an incoming message without needing the Meta side wired up:

node scripts/simulate-message.js "do you have free shipping?"
node scripts/simulate-message.js "what colors are the wide-leg pants?"
node scripts/simulate-message.js "are you open right now?"

Watch the server logs to see the routing decision (FAQ hit vs AI fallback), token counts, and the reply it would have sent to WhatsApp.

Production hardening (when you're ready)

The starter is intentionally minimal. Things you'll want to add when scaling past one shop:

  • Per-customer state / history: this version is stateless. Add Redis or Postgres to remember conversations across messages — useful for "what was my last order?" type questions.
  • Human handoff signal: detect phrases like "speak to human" and forward to a real team member's inbox. We don't ship this; teams build it differently.
  • Rate limiting: WhatsApp itself rate-limits inbound, but you may want per-user caps to prevent a single chatty user burning all your AI budget.
  • Analytics: log conversations to BigQuery / a CSV / a Sheets export to understand what customers ask.
  • Multi-language: this version auto-detects per-message language in the AI prompt; for FAQ matching, you'd want translated keywords per language.

License

MIT. Use it however you want, commercial or not, no attribution required. PRs welcome but not expected.

Related

If your bot ends up burning more than $20/mo in tokens, message us on the cloudgpu.app dashboard — you may qualify for raised rate limits or volume pricing.

About

Production-ready WhatsApp Business autoresponder powered by cloudgpu.app + DeepSeek-V4. One-click deploy to Railway / Fly.io, pay in USDT. No Western credit card needed.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages