Docs · Setup

Connect Twilio (WhatsApp) in 5 minutes

One-time setup in Twilio's console. After this every café manager can pair their WhatsApp number and get morning briefs + reorder approvals on WhatsApp instead of (or in addition to) Telegram.

1

Open Twilio's console

Go to console.twilio.com. If you don't have an account, click Sign up — Twilio gives you a free trial with $15 credit. Plenty for one café's test messaging volume.

2

Copy Account SID + Auth Token

Top of the dashboard, under Account Info:

  • Account SID — starts with AC followed by 32 hex chars. Copy it.
  • Auth Token — click the eye icon to reveal, then copy. 32 hex chars.
3

Activate the WhatsApp Sandbox

Left nav → MessagingTry it out Send a WhatsApp message. Twilio gives you a sandbox phone number — usually +1 415 523 8886 — and a join code like join <word>.

From your real WhatsApp, send the join code to that number. Once Twilio confirms you're joined, your sandbox is live.

Sandbox is for testing. For production WhatsApp messaging at scale you'll register a real Business sender — but the dev sandbox is enough to wire the bot end-to-end.

4

Set the inbound webhook URL

Same Sandbox screen, scroll to Sandbox settings. In the field “When a message comes in” paste:

Webhook URL

https://stockpilot-app-production-2a53.up.railway.app/api/bot/whatsapp

Method: POST. Save. Twilio now posts every inbound WhatsApp message to StockPilot, signed with your auth token — so the app can verify the request actually came from Twilio (not spoofed) before acting on it.

5

Paste all three into Railway

Open your StockPilot service on Railway Variables tab → + New Variable three times:

  • TWILIO_ACCOUNT_SID=paste the Account SID
  • TWILIO_AUTH_TOKEN=paste the Auth Token
  • TWILIO_WHATSAPP_FROM=whatsapp:+14155238886 (the sandbox number, with the whatsapp: prefix)

Railway redeploys automatically — takes ~60 seconds.

6

Pair WhatsApp from Settings

Reload /settings. The WhatsApp row no longer says “not configured”. Click Pair WhatsApp, you'll get a 6-digit code → text it to the Twilio sandbox number. The bot replies and the row flips to Live · paired as +1….

From this point forward, morning briefs and reorder approvals land on WhatsApp.
← Back to Settings