← 所有消息

A WhatsApp number as an ordinary route

Phlo WhatsApp is a gateway process that puts a WhatsApp number behind a normal Phlo route. Inbound messages arrive at a webhook, outbound go through a local bridge.

require('./phlo-whatsapp.js')('wa1', 8081, '<secret>', 'https://app.example.com/receive/whatsapp/web/wa1')

One process per number. On first start it prints a QR code in the terminal, you scan it with the account that instance should act as, and the session persists, so that is a one-time step rather than a login flow to build.

The shape is deliberate: the gateway does WhatsApp and nothing else. It holds no application state and makes no decisions; it turns messages into HTTP calls in one direction and HTTP calls into messages in the other. On the app side the engine's WhatsApp resource handles the webhook, so receiving a message is a route like any other, and the Phlo Dashboard shows the status of every instance across the fleet.

That separation is what keeps it from being a lock-in. wapps.nu, the app that drove this, treats WhatsApp as one channel among fourteen: email, Instagram, Messenger, Slack, Telegram, Teams, LinkedIn, Intercom, SMS through two providers. Each is a provider file with the same shape. WhatsApp is the one that needed a process of its own, because the web client does, and none of that leaked into how the app talks to it.

Phlo WhatsApp 1.0.1. See the WhatsApp handbook.

我们使用必要的cookie来使该网站正常工作。在您的许可下,我们还使用分析工具来改善网站。