Whatsapp Shell May 2026
Imagine this: You are sitting in a cafe, miles away from your laptop, when you realize you forgot to restart a critical server. Or perhaps you need to quickly check the logs of a crashing application. You don’t have your SSH keys, you don’t have a terminal emulator on your phone, and the mobile data connection is spotty.
What do you do? You open WhatsApp.
Welcome to the concept of the WhatsApp Shell—a bizarre, brilliant, and surprisingly practical way to turn the world’s most popular messaging app into a command-line interface for your servers. whatsapp shell
const default: makeWASocket, useMultiFileAuthState, DisconnectReason = require('@whiskeysockets/baileys'); const qrcode = require('qrcode-terminal'); const Boom = require('@hapi/boom'); const readline = require('readline');// Setup authentication state (saves session so you don't scan QR every time) const authPath = './auth_info';
async function startShell() const state, saveCreds = await useMultiFileAuthState(authPath); Imagine this: You are sitting in a cafe,
const sock = makeWASocket( auth: state, printQRInTerminal: false, // We'll handle QR manually logger: require('pino')( level: 'silent' ) ); // Generate QR Code for scanning (mobile app -> Linked Devices) sock.ev.on('connection.update', (update) => const connection, lastDisconnect, qr = update; if (qr) console.log('Scan this QR code with WhatsApp Mobile:'); qrcode.generate(qr, small: true ); if (connection === 'close') const shouldReconnect = (lastDisconnect.error?.output?.statusCode !== DisconnectReason.loggedOut); if (shouldReconnect) startShell(); else if (connection === 'open') console.log('WhatsApp Shell Active. Type "send [number] [message]"'); askCommand(sock); ); sock.ev.on('creds.update', saveCreds); // Listen for incoming messages sock.ev.on('messages.upsert', async (m) => const msg = m.messages[0]; if (!msg.key.fromMe && msg.message?.conversation) console.log(`\n[Incoming] $msg.key.remoteJID: $msg.message.conversation`); askCommand(sock); // Redisplay prompt );// Simple CLI Interface const rl = readline.createInterface( input: process.stdin, output: process.stdout ); // Simple CLI Interface const rl = readline
function askCommand(sock) rl.question('>> ', async (input) => if (input.toLowerCase() === 'exit') console.log('Goodbye.'); process.exit(0); if (input.startsWith('send ')) const parts = input.split(' '); const number = parts[1]; const message = parts.slice(2).join(' '); const jid = number.includes('@s.whatsapp.net') ? number :
$number@s.whatsapp.net; try await sock.sendMessage(jid, text: message ); console.log(Sent to $number: $message); catch (err) console.error('Failed to send:', err.message); else console.log('Unknown command. Use: send [phone number] [message]'); askCommand(sock); );
startShell();
A non-profit used a WhatsApp Shell internally to notify volunteers about disaster relief shifts. They kept volume low (under 100 messages/day) and never spammed. The shell ran for 2 years without issues.