Deploy wacli API (Self-Hosted)

Self-host wacli with a FastAPI API, token auth and persistent sessions.

Deploy wacli API (Self-Hosted)

Deploy and Host wacli API (Self-Hosted) on Railway

wacli API adds a FastAPI HTTP API to the wacli WhatsApp client. This template includes token authentication, a public HTTPS domain, persistent session storage, and continuous sync after you link your phone.

About Hosting wacli API (Self-Hosted)

The template deploys one service with FastAPI and wacli, plus a persistent /data volume. Your linked-device session and synced messages survive redeployments. The API and sync worker run together, so no separate database or API service is required.

Common Use Cases

  • Send WhatsApp text messages from a Laravel application.
  • Connect your own backend to a WhatsApp account through HTTP.
  • Check whether the linked WhatsApp session is authenticated.

Dependencies for wacli API (Self-Hosted) Hosting

  • Persistent storage and a public HTTPS domain, included in this template.
  • A WhatsApp account and access to its primary phone.
  • Railway Console access to pair the phone.

Deployment Dependencies

Implementation Details

After deployment, open the service’s Console tab and run wacli-pair. On your phone, open WhatsApp → Linked devices → Link a device and scan the QR code. You can also run wacli-pair --phone +15551234567 to link using a phone-number code. Once pairing and the initial sync finish, the worker starts continuous sync.

Copy API_TOKEN from Railway’s Variables tab. Send it as Authorization: Bearer YOUR_API_TOKEN when calling GET /session or POST /messages. To send a text message, post a JSON object with message and to, using an international phone number such as +15551234567. Open /docs on the public domain for interactive API documentation.

A successful send returns HTTP 202 and a message ID. This means WhatsApp accepted the send, not that the recipient received it. The API never automatically retries a send. Keep one replica per volume, and link a phone separately for each deployment.

See the source repository for the Laravel example, variables, and API responses. wacli uses the WhatsApp Web protocol and is not affiliated with WhatsApp or Meta.

Why Deploy wacli API (Self-Hosted) 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 wacli API (Self-Hosted) on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
121
View Template
Evolution API with n8n
Automate WhatsApp workflows with Evolution API, n8n, and Postgres.

codestorm
102
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
870