whatsapp/chat-api
whatsapp/chat-api is a Laravel/PHP package for integrating WhatsApp chat messaging into your application. It provides a convenient API for connecting your app to WhatsApp chat services and handling common messaging workflows.
What the package is. whatsapp/chat-api (mgp25/Chat-API lineage) is a reverse-engineered PHP client for the WhatsApp wire protocol. It emulates a WhatsApp client: registering a phone number via SMS/voice, negotiating Noise/Curve25519-style key exchange, exchanging protobuf-encoded binary frames, and maintaining a long-lived socket session. It is not a wrapper over an official Meta API — it is an unsupported implementation of a private, undocumented, and deliberately obfuscated protocol, with no contractual or technical relationship to WhatsApp.
Architecture fit. Poor for anything Laravel does idiomatically. The library assumes a long-running stateful process holding an open socket, an on-disk identity/key store, and a registered phone number per session. That is the opposite of PHP-FPM's request-scoped, stateless execution model. Making it fit requires a dedicated worker tier (Supervisor/queue-driven daemons), a session registry keyed by phone number, and a persistence layer for keys and message state that the package does not provide. Every one of those is a component we would own and operate, not the vendor.
Integration feasibility. Technically possible in a spike; not feasible as a production dependency. The registration surface it targets has been progressively deprecated by WhatsApp in favour of the multi-device pairing flow, which this library predates. In practice, current registration attempts via this code path are likely to fail outright or produce numbers that are rate-limited or instabanned. Feasibility therefore depends less on our engineering effort than on whether the upstream protocol happens to still accept the handshake — a condition we cannot control, test against in CI, or negotiate.
Technical risk. This is the dominant section of the assessment, and it is all red:
Key questions for the business before any code is written:
Stack fit. Treat the library as a swappable driver behind a Laravel-native interface, never as a direct dependency in application code. Define a WhatsAppGateway contract (sendText, sendMedia, sendTemplate, onInbound) with two implementations: CloudApiGateway (official, default) and LegacyChatApiGateway (this package, opt-in, feature-flagged, environment-gated). Bind via the service container and resolve from config. Domain code, jobs, and notifications see only the contract, so the eventual migration is a config change rather than a refactor.
Isolation. The socket-holding process must not share a runtime with the web tier. Put it in its own container/service with its own Supervisor program, its own storage volume for session keys, and its own log stream. Expose it to Laravel over an internal queue (SQS/Redis) or a private HTTP boundary. That gives us a blast radius we can kill with a flag and a deployment, and it keeps key material out of the application servers.
Migration path. Sequence deliberately: (1) time-boxed spike against one disposable number to establish whether registration and send/receive still function at all; (2) if it does, ship the gateway abstraction and the official Cloud API implementation first, with the legacy driver behind a feature flag used only for internal notifications; (3) define the cutover criteria for retiring the legacy driver before it is ever switched on in production. The official path also unlocks template management, delivery webhooks, and business verification — capabilities that make the unofficial path look strictly worse on product grounds, not just on risk.
Compatibility. Expect pinned legacy PHP constraints, required extensions (curl, sockets, openssl, gmp, and a protobuf implementation), and conflict with modern dependency trees. Run it in a dedicated container image so it cannot constrain the main application's PHP or framework upgrades. Note also that it will not participate in Laravel's queue retry semantics cleanly — a socket disconnect is not a failed job, and the library's own reconnect behaviour must be wrapped with a supervisor and a dead-session detector.
Sequencing. Contract and official driver → observability and outbound audit log → spike → risk sign-off → flag-gated internal pilot → explicit decision point on whether to proceed or stop. Never let the pilot silently become production by inertia.
Maintenance. The package is effectively unmaintained. Adopting it means forking it, owning the fork, and accepting that every WhatsApp protocol revision is an unplanned, unbounded engineering incident with no upstream fix to pull. Budget this as an ongoing headcount cost, not a one-off integration.
Support. There is no vendor, no SLA, no security advisory feed, and no support channel. Internal escalation ends with our own engineers reading packet captures. Any incident review will terminate at "the upstream protocol changed and we could not adapt in time."
Scaling. Not horizontally scalable in the usual sense. Sessions are pinned to a phone number and a single socket, so scaling is by number — N numbers means N sessions, N registration flows, N ban exposures, and sticky routing in front of them. State lives in files and memory rather than in a shared store, which makes autoscaling and zero-downtime deploys awkward and makes a lost volume equal a lost identity. Throughput per session is also rate-limited by an entity that does not want us there.
Failure modes to design for explicitly:
Ramp-up. Steep and narrow. The knowledge required is WhatsApp protocol internals plus this library's specific idioms, held by very few people. Onboarding a new engineer takes weeks and produces no transferable skill. Contrast that with the Cloud API, where onboarding is measured in days and the knowledge is documented and reusable.
Recommendation. Do not adopt this package as a production integration. Approve at most a single-digit-day spike, on a disposable number, behind a feature flag, with Legal and Security sign-off on record, and only if the requester can articulate why the official WhatsApp Business Platform is insufficient. The realistic outcome of that spike is a decision to build on the Cloud API — which is where a TPM should be steering the conversation from the start.
How can I help you explore Laravel packages today?