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.
Simple HTTP, any language
Receive inbound messages
Self-hosted, always free
Every API request requires two credentials:
| Credential | Query param | Header |
|---|---|---|
| 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.
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
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
POST/send
| Param | Where | Notes |
|---|---|---|
| clientidrequired | query or header | Your client ID |
| keyrequired | query or header | Your secret key |
| torequired | query or body | Phone number. + and spaces accepted. @lid and @g.us passed as-is. |
| messagerequired | JSON body | Message 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..." }
GET/logs — last 100 messages, oldest auto-deleted.
curl "https://wpsent.xyz/logs?clientid=YOUR_CID&key=YOUR_KEY"
GET/status
{ "phone": "8801711000000", "status": "ready" }
Status values: initializing, qr_ready, ready, disconnected, auth_failure, error.
Add URLs to receive a request on every inbound message. Query params in your URL are preserved.
POST /webhooks
x-client-id: YOUR_CID
x-api-key: YOUR_KEY
{ "url": "https://yoursite.com/hook?key=abc", "method": "POST", "label": "My CRM" }
PATCH /webhooks/:id { "active": false } DELETE /webhooks/:id
{
"event": "message_received",
"from": "8801711000000",
"body": "Hello!",
"type": "text",
"timestamp": "2024-01-01T10:30:00.000Z"
}
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());
import requests
r = requests.post('https://wpsent.xyz/send',
params={'clientid':'YOUR_CID','key':'YOUR_KEY','to':'8801711000000'},
json={'message': 'Hello!'})
print(r.json())
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)
| type | body value |
|---|---|
| text | The message text |
| reaction | [Reaction: 👍] |
| sticker | [Sticker] |
| image | [Image] or caption |
| video | [Video] |
| audio | [Audio] |
| document | [Document: filename] |
| location | [Location: lat,lng] |
| contact | [Contact card] |
Need help setting up your own instance?
📷 Instagram: https://instagram.com/YOUR_INSTAGRAM
💌 Email: your@email.com
📄 GitHub: https://github.com/YOUR_USERNAME/wpsent