loginwa
OfficialProvides tools for interacting with the LoginWA WhatsApp API, including device status, OTP verification, sending messages, and broadcasts.
LoginWA MCP Server
Unofficial MCP server for the LoginWA WhatsApp API. LoginWA hosts the WhatsApp engine, so an agent can check devices, send OTP, run reverse OTP, send messages, and run broadcasts without operating a VPS.
Tools: device_status, otp_start / otp_verify, reverse_otp_start /
reverse_otp_status, send_message, delete_message, get_message, and
broadcast (list_campaigns, get_campaign, create_campaign, send_campaign).
npx -y @loginwa/mcpSet LOGINWA_API_KEY. Pair devices at loginwa.com/welcome.
Client configs: mcp/README.md.
This repository also ships JavaScript, PHP and Android SDKs, an embeddable OTP widget, and a Postman collection. No server code is included.
Contents
js/, JavaScript SDK (ESM), dependency-free client.php/, PHP SDK (cURL-based, PHP >= 8.0).android/, Android SDK (Kotlin library + runnable sample app).mcp/, TypeScript MCP server (@loginwa/mcp): device status, OTP, reverse OTP, send, broadcast for AI agents. Install withnpx -y @loginwa/mcp. Seemcp/README.md.snippet/otp-widget.html, drop-in OTP widget example.docs/postman/loginwa-api.postman_collection.json, Postman collection.docs/sdk.md, quick reference for these assets.
Paths are relative to the repository root. Inside the LoginWA application
repository these same files live under laravel-app/sdk/, which is the single
source they are published from, edit them there, never here.
Related MCP server: zaileys-mcp
API Basics
Base URL (host):
https://api.loginwa.comSDK default (includes version prefix):
https://api.loginwa.com/api/v1Auth:
Authorization: Bearer <YOUR_API_KEY>(orX-Api-Key)Content-Type:
application/jsonAlso reachable at
https://loginwa.com/api(same routes under/api/…)
OTP product paths: SDKs call /auth/start and /auth/verify against the
/api/v1 base (i.e. POST /api/v1/auth/start|verify). The preferred narrative
docs path /api/auth/start|verify is equivalent for sending/verifying codes;
v1 start responses also include sent_via_engine and quota_remaining, and
v1 verify returns phone (not phone_number).
Reverse OTP ("Login with WhatsApp"): POST /api/v1/auth/reverse/start returns
a message (LOGIN <code>) and a wa_link to your connected number. The user
sends it; LoginWA sends nothing and bills only on success. Poll
GET /api/v1/auth/reverse/{session_id} or listen for the otp.verified
webhook. Omit phone to accept any sender and get their number back; pass
phone to accept only that number.
Quick Start
JavaScript SDK
cd sdk/js
npm install
# import into your app (ESM)import { LoginWAClient } from '@loginwa/sdk';
const client = new LoginWAClient({ apiKey: process.env.LOGINWA_API_KEY });
try {
const start = await client.startOtp({ phone: '6281234567890', countryCode: '62' });
const verify = await client.verifyOtp({ sessionId: start.session_id, otpCode: '123456' });
console.log('verified', verify);
} catch (err) {
console.error('OTP error', err?.status, err?.data || err.message);
}
// Reverse OTP: show rev.wa_link as a button (mobile) or QR (desktop)
const rev = await client.startReverseOtp();
const state = await client.getReverseOtp(rev.session_id); // pending | verified | expired | failedPHP SDK
cd sdk/php
composer install<?php
require __DIR__ . '/vendor/autoload.php';
$client = new LoginWA\SDK\Client('YOUR_API_KEY');
try {
$start = $client->startOtp(['phone' => '6281234567890', 'country_code' => '62']);
$verify = $client->verifyOtp(['session_id' => $start['session_id'], 'otp_code' => '123456']);
var_dump($verify);
} catch (\LoginWA\SDK\ApiException $e) {
// HTTP status is in $e->getCode()
echo 'OTP error: ' . $e->getCode() . ' ' . $e->getMessage();
}
$rev = $client->startReverseOtp(); // show $rev['wa_link'] as a button or QR
$state = $client->getReverseOtp($rev['session_id']); // status: pending|verified|expired|failedMCP server (@loginwa/mcp)
cd sdk/mcp && npm install && npm run build
# clients: npx -y @loginwa/mcpSet LOGINWA_API_KEY. Details and client configs: mcp/README.md.
OTP Widget Snippet
Open sdk/snippet/otp-widget.html, set your API key/Base URL, and embed in any page. Uses Fetch to call /auth/start and /auth/verify.
Postman Collection
Import docs/postman/loginwa-api.postman_collection.json, set base_url (default https://api.loginwa.com) and api_key variables, then run the flows.
Common errors
401 unauthorized, missing/invalid API key.402 subscription_suspended, inactive, suspended, or past-due subscription.422 invalid_code|expired|blocked, verification failed.429 quota_exceeded, monthly plan quota exceeded.429 rate_limited, too many requests per minute (Retry-Afterheader).404 session_not_found, reverse OTP session id unknown for this app.503 no_device_connected, no online WhatsApp device for the app.Network/timeout, retry with backoff; SDK throws with HTTP status in error object/exception code.
Download
Packaged ZIP (same contents as this repo): https://loginwa.com/loginwa-batch1-sdk.zip
Changelog
See CHANGELOG.md.
Support
Questions/feedback: dev@loginwa.com
Available Tools
8 toolscreate_campaignCreate broadcast campaignA
Create a LoginWA broadcast campaign with an inline contact list. Starts as draft (or queued if schedule_at is set). Call send_campaign to begin.
Inputs: name (required), message (required), contacts (required), media_url, +3 more.
device_statusDevice statusA
List LoginWA WhatsApp devices (or one device by id) and report online/offline honestly. If a device is not online, instruct the user to open https://loginwa.com/welcome to pair. Does not start in-chat QR/pairing races.
Inputs: device_id.
get_campaignGet broadcast campaignA
Get details for a LoginWA broadcast campaign by id.
Inputs: campaign_id (required).
list_campaignsList broadcast campaignsB
List LoginWA broadcast campaigns (paginated).
Inputs: page.
otp_startStart OTPA
Start a LoginWA OTP session: send a one-time code to a WhatsApp phone number via a connected device.
Inputs: phone (required), device_id, otp_length, country_code, +1 more.
otp_verifyVerify OTPA
Verify an OTP code against a LoginWA session_id returned by otp_start.
Inputs: otp_code (required), session_id (required).
send_campaignSend broadcast campaignA
Queue a draft/queued/paused LoginWA campaign for sending. Requires at least one online device; otherwise direct the user to https://loginwa.com/welcome
Inputs: campaign_id (required).
send_messageSend WhatsApp messageC
Send a WhatsApp text or media message from a connected LoginWA device. Media types require a public https media_url.
Inputs: phone (required), ptt, type, caption, +5 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Every tool has a clearly distinct purpose: device status, OTP start/verify, message sending, and campaign management (list, get, create, send). No two tools overlap in function, so an agent can confidently select the right one based on the action needed.
Most tools follow the verb_noun pattern (get_campaign, send_message, list_campaigns, etc.), but device_status breaks the pattern by using a noun_noun form instead of something like get_device_status. This is a minor deviation from an otherwise consistent style.
With 8 tools, the set is well-scoped for a WhatsApp service covering messaging, OTP, and campaigns. Each tool earns its place without bloat or excess, staying comfortably within the ideal 3-15 range.
The core workflows are covered: send messages, handle OTP, and manage campaigns. However, campaign management lacks update/delete operations, and device management is limited to status only. These are minor gaps that agents can work around but might require external fallback.
Maintenance
Related MCP Connectors
WhatsApp for AI agents — your own number or the official Cloud API: messages, media, templates.
Read-only WhatsApp MCP for your AI agent: it reads the chats you choose. Try the public demo.
WhatsApp for your AI agent, sent from your own number. Source-available (Elastic License 2.0).
WhatsMCP connects Claude and other MCP-compatible AI agents directly to WhatsApp. Send and receive text, images, documents, and voice notes; manage groups (create, add/remove members, promote admins); look up contacts and profiles; follow channels; and read call and message history — all through a standard MCP interface. For voice use cases, WhatsMCP offers SIP-based calling plans (inbound-only, or full inbound/outbound) so AI voice agents can answer and place WhatsApp calls, plus low-latency WebSocket integrations with voice agent providers like ElevenLabs. Multiple WhatsApp accounts can be paired and managed per workspace, with webhook support for real-time inbound message delivery to your own infrastructure.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceWhatsApp MCP server that exposes messaging, groups, contacts, and profile management as tools and resources for AI agents, supporting Baileys and Meta Cloud API.272 npm28MIT
- AlicenseBqualityDmaintenanceEnables AI agents to control WhatsApp, including sending messages and media, reading chats, managing groups and communities, with QR/pairing auth and session persistence.1419 npm2MIT
- AlicenseAqualityBmaintenanceMCP server for Kirimi WhatsApp API, enabling AI agents to send messages, broadcast, manage devices, and contacts.199 npmMIT
- AlicenseNot gradedqualityDmaintenanceA self-hosted WhatsApp gateway that exposes messaging capabilities via MCP, allowing AI agents to send, receive, and manage WhatsApp messages through a single-command setup with SQLite storage.1MIT