WhatsApp API for PHP
Uses the cURL extension that ships with most PHP installs. There is no official SDK, just one HTTP request.
Send a message with PHP
<?php
$ch = curl_init("https://quackapi.com/v1/messages/chat");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: " . getenv("QUACKAPI_KEY"),
],
CURLOPT_POSTFIELDS => json_encode([
'deviceId' => 1,
'to' => '923001234567',
'body' => 'Hello from QuackAPI',
]),
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status . " " . $response;Before you run it
- Connect a device and use its numeric id as deviceId.
- Set QUACKAPI_KEY to your wa_ key.
- Run this on a server. Never ship the key to a browser or app.
Handling errors
Non-2xx responses carry a JSON message. See the errors page for what each code means and which to retry.
Related
Last reviewed 2026-11-09. QuackAPI is an unofficial linked-device service. Acceptable use