Getting Started

Introduction Authentication Self-Hosting

API Reference

Send Message Message Logs Status Webhooks

Guides

Code Examples Message Types Contact

WPSent API Docs

WPSent is a self-hosted WhatsApp API gateway. Link your number once, get a Client ID and Secret Key, then send and receive messages via REST API.

⚡

REST API

Simple HTTP, any language

🔗

Webhooks

Receive inbound messages

🟢

No fees

Self-hosted, always free

Authentication

Every API request requires two credentials:

CredentialQuery paramHeader
clientid?clientid=x-client-id
key?key=x-api-key

Your Secret Key is also your dashboard login password. Find both on your dashboard after scanning the QR code.

Self-Hosting

Railway (recommended)

1. Fork: https://github.com/YOUR_USERNAME/wpsent
2. New project on railway.app → Deploy from GitHub
3. Add env var: MONGO_URI = your MongoDB Atlas URI
4. Add env var: SINGLE_USER = true  (optional, limits to 1 user)
5. Deploy — Chromium installs automatically

Local

git clone https://github.com/YOUR_USERNAME/wpsent
cd wpsent
cp .env.example .env   # add MONGO_URI
npm install
npm start              # visit http://localhost:3000

Send a Message

POST/send

ParamWhereNotes
clientidrequiredquery or headerYour client ID
keyrequiredquery or headerYour secret key
torequiredquery or bodyPhone number. + and spaces accepted. @lid and @g.us passed as-is.
messagerequiredJSON bodyMessage text
curl -X POST "https://wpsent.xyz/send?clientid=YOUR_CID&key=YOUR_KEY&to=8801711000000" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello!"}'

Response:

{ "ok": true, "logId": "64f3a..." }

Message Logs

GET/logs — last 100 messages, oldest auto-deleted.

curl "https://wpsent.xyz/logs?clientid=YOUR_CID&key=YOUR_KEY"

Connection Status

GET/status

{ "phone": "8801711000000", "status": "ready" }

Status values: initializing, qr_ready, ready, disconnected, auth_failure, error.

Webhooks

Add URLs to receive a request on every inbound message. Query params in your URL are preserved.

Add

POST /webhooks
x-client-id: YOUR_CID
x-api-key: YOUR_KEY
{ "url": "https://yoursite.com/hook?key=abc", "method": "POST", "label": "My CRM" }

Toggle / Delete

PATCH /webhooks/:id  { "active": false }
DELETE /webhooks/:id

Payload

{
  "event":     "message_received",
  "from":      "8801711000000",
  "body":      "Hello!",
  "type":      "text",
  "timestamp": "2024-01-01T10:30:00.000Z"
}

Code Examples

Node.js

const res = await fetch(
  'https://wpsent.xyz/send?clientid=YOUR_CID&key=YOUR_KEY&to=8801711000000',
  { method:'POST', headers:{'Content-Type':'application/json'},
    body: JSON.stringify({ message: 'Hello!' }) }
);
console.log(await res.json());

Python

import requests
r = requests.post('https://wpsent.xyz/send',
    params={'clientid':'YOUR_CID','key':'YOUR_KEY','to':'8801711000000'},
    json={'message': 'Hello!'})
print(r.json())

Webhook receiver (Flask)

from flask import Flask, request
app = Flask(__name__)
@app.route('/hook', methods=['POST'])
def hook():
    d = request.json
    print(f"{d['from']}: {d['body']} ({d['type']})")
    return {'ok': True}
app.run(port=5000)

Message Types

typebody value
textThe message text
reaction[Reaction: 👍]
sticker[Sticker]
image[Image] or caption
video[Video]
audio[Audio]
document[Document: filename]
location[Location: lat,lng]
contact[Contact card]

Contact & Support

Need help setting up your own instance?

📷 Instagram: https://instagram.com/YOUR_INSTAGRAM

💌 Email: your@email.com

📄 GitHub: https://github.com/YOUR_USERNAME/wpsent