WhatsApp API for Python

Uses the requests library (pip install requests). There is no official SDK, just one HTTP request.

Send a message with Python

Python
import os
import requests

response = requests.post(
    "https://quackapi.com/v1/messages/chat",
    headers={"x-api-key": os.environ["QUACKAPI_KEY"]},
    json={
        "deviceId": 1,
        "to": "923001234567",
        "body": "Hello from QuackAPI",
    },
    timeout=15,
)
response.raise_for_status()
print(response.json())  # {'success': True, 'messageId': 123, 'status': 'queued'}

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