Add WhatsApp to an App Built With ChatGPT (Groups and Members)
ChatGPT can write the app, but it cannot guess your WhatsApp API. Give it these four endpoints and one safe place for the key, and it can list groups, read members and send.
Daniel Roth7 min read

On this page
Short answer: Create an API key in Blueticks, keep it in your app's server-side secrets, and paste the spec below into ChatGPT so it calls four endpoints: GET /v1/groups, GET /v1/groups/{id}?include=participants, POST /v1/scheduled-messages/{chatId} and POST /v1/groups/{id}/members. The messages go out from your own WhatsApp number, not from the Meta Cloud API.
A model that writes your app will happily invent a WhatsApp endpoint if you do not hand it a real one. The usual result is a function that looks right and returns a 404. This guide gives it the real surface, checked against the Blueticks backend on 2026-11-22.
What do you need before you start?
Three things:
- An API key. Create one on the API page of the dashboard, at app.blueticks.co/blueticks-api. It starts with
bt_live_and goes in anAuthorization: Bearer <key>header. - A connected WhatsApp. Your number has to be linked in Blueticks, in the browser extension or on the cloud gateway. Calls to
GET /v1/pingreturnapi: "ok"plus awhatsappConnectionslist, and an empty list means nothing is connected. - The base URL.
https://api.blueticks.co.
One limit to know about while you prototype. An account with no active subscription gets 5 API requests per six-hour window, shared with the MCP connector. A paid plan removes that cap. Five requests disappear fast once ChatGPT's code starts polling, so test with a paid account or keep the app's calls few.
Where should the API key live?
On the server, never in the page. The key can send messages as you and add people to your groups, so anything a browser can read is a leak.
Tell ChatGPT this explicitly, because the default tends to be a fetch call from the front end. The key belongs in an environment variable or secret on whatever runs your backend code (a server route, an edge function, a serverless function). The browser calls your route, and your route calls Blueticks.
What should you paste into ChatGPT?
Paste this, then describe the feature you want on top of it:
Add WhatsApp to this app through the Blueticks REST API.
Rules:
- Base URL: https://api.blueticks.co
- Every request sends the header Authorization: Bearer <BLUETICKS_API_KEY>.
- Read the key from the server environment variable BLUETICKS_API_KEY.
Never put it in client-side code and never log it.
- Call Blueticks only from server code. The browser calls our own route.
Endpoints to use, and only these:
1. GET /v1/groups?searchToken=<name>&limit=25
Returns { data: [...], limit, skip, total }. Each group has id (ends in @g.us), name, participantCount.
2. GET /v1/groups/{groupId}?include=participants
The group is under data. Its data.participants array has { chatId, isAdmin, isSuperAdmin, name }.
3. POST /v1/scheduled-messages/{chatId}
chatId is a group id like 120363000000000000@g.us or a phone like +15551234567.
JSON body: { "type": "text", "text": "..." }. Omit sendAt to send now. The message is under data.
4. POST /v1/groups/{groupId}/members
JSON body: { "participants": ["+15551234567", "+15557654321"] }.
The per-person results are in data.participants.
Every successful response is JSON with success: true. A list has its rows in data
(plus limit, skip, total); a single object is also under data.
Handle these cases: a 429 (wait for the Retry-After header), a 403 (the key lacks a scope),
and a 202 on a send (it was handed to WhatsApp but not yet confirmed; do not resend).That block is the whole contract. If ChatGPT proposes an endpoint that is not on the list, it made it up.
How do you find a group and read its members?
List groups with a name search, then fetch the one you want with its members inlined:
// server route
const H = { Authorization: `Bearer ${process.env.BLUETICKS_API_KEY}` };
const list = await fetch(
"https://api.blueticks.co/v1/groups?searchToken=warehouse&limit=25",
{ headers: H },
).then((r) => r.json());
const groupId = list.data[0].id; // "120363...@g.us"
const group = await fetch(
`https://api.blueticks.co/v1/groups/${groupId}?include=participants`,
{ headers: H },
).then((r) => r.json()).then((j) => j.data);
const admins = group.participants.filter((p) => p.isAdmin);A list row is slimmer than a single group. It has no participants and no announce, so a model that reads participants off the list will get undefined. That is why the prompt above says to fetch the single group with include=participants. Members are also available at GET /v1/chats/{chatId}/participants.
For the full group surface (create, remove, promote, why a send to one group fails), read the WhatsApp group API guide.
How do you send a message to a group?
A group id goes in the path, exactly like a phone number:
const res = await fetch(
`https://api.blueticks.co/v1/scheduled-messages/${encodeURIComponent(groupId)}`,
{
method: "POST",
headers: { ...H, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({ type: "text", text: "Order 4182 is packed." }),
},
);The name says "scheduled", but leaving out sendAt sends it now. A 201 means it was sent. A 202 means WhatsApp had not confirmed within about 50 seconds: the message in the response carries an id and a statusUrl, and you poll that instead of sending again.
The Idempotency-Key header (up to 64 characters) makes a retry safe, so one click that fires twice sends once. Generating a fresh UUID per click, as above, protects against double submits inside one request. To protect a real retry, reuse the same key for the same message.
How do you add people to a group?
One call can add up to 256 people:
const out = await fetch(`https://api.blueticks.co/v1/groups/${groupId}/members`, {
method: "POST",
headers: { ...H, "Content-Type": "application/json" },
body: JSON.stringify({ participants: ["+15551234567", "+15557654321"] }),
}).then((r) => r.json());A 200 does not mean everyone was added. Read out.data.participants: each entry has a status of added, already, invited (their privacy settings only allow an invite, which was sent), not_found or refused. Show those to the user instead of a blanket "done".
What goes wrong most often?
- Nothing is connected. Check
GET /v1/pingfirst. An emptywhatsappConnectionsmeans the number is not linked right now. - Rate limits. Sends are limited per key (60 per minute). A
429includesRetry-After. - A missing scope. A key without the right scope gets a
403. Create the key with Full access (the dashboard default); a Read-only key gets a403on sends. - Unknown fields. Group create and member bodies are strict. A field the API does not know is rejected, not ignored, which is how a model's invented
membersfield shows up.
To get replies back into your app, register a webhook rather than polling: WhatsApp webhooks and auto-reply. If you would rather have ChatGPT operate your WhatsApp directly than build an app around it, see connecting WhatsApp to ChatGPT with MCP.
FAQ
Does ChatGPT need to know my WhatsApp password? No. The app holds an API key. The number is linked once in Blueticks.
Can I send to a group by its name? Not directly. Send to the group's id. Search by name with searchToken on GET /v1/groups, then use the id.
Is this the official WhatsApp Business API? No. It sends through your own WhatsApp number via a connected Blueticks engine, so there is no Meta business verification or template approval.
Want more WhatsApp recipes? Join the free WhatsApp Growth Recipes community.


