Send a WhatsApp message with curl, Node.js or Python
Updated
Short answer: To send a WhatsApp message over HTTP, POST JSON with "number" and "text" to /message/sendText/{instance} on your Weai subdomain, authenticating with your instance token in the apikey header.
curl
curl -X POST https://{name}.eai.menustudioai.com/message/sendText/{instance} \
-H "apikey: YOUR_INSTANCE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"number":"34600000000","text":"Hello!"}'Node.js (fetch)
const res = await fetch('https://{name}.eai.menustudioai.com/message/sendText/{instance}', {
method: 'POST',
headers: { apikey: process.env.WEAI_TOKEN, 'Content-Type': 'application/json' },
body: JSON.stringify({ number: '34600000000', text: 'Hello!' }),
});
console.log(await res.json());Python (requests)
import os, requests
r = requests.post(
"https://{name}.eai.menustudioai.com/message/sendText/{instance}",
headers={"apikey": os.environ["WEAI_TOKEN"]},
json={"number": "34600000000", "text": "Hello!"},
)
print(r.json())Images, documents, audio and video
Use POST /message/sendMedia/{instance} with "mediatype" (image, document, audio or video), a public "media" URL and an optional "caption".
curl -X POST https://{name}.eai.menustudioai.com/message/sendMedia/{instance} \
-H "apikey: YOUR_INSTANCE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"number":"34600000000","mediatype":"image","media":"https://example.com/img.png","caption":"Look at this"}'- Keep the instance token on your server; never ship it in browser or mobile code.
- Polls, interactive lists, locations and stickers follow the same pattern; see the API reference.
Your phone. Your API. From 5.50 €/instance a month.