Integrate Supergreen WhatsApp automation into your application using our HTTP API.
All API endpoints require authentication using your account's secret token. You can find this token in your WhatsApp account settings on the main dashboard.
Base URL: https://api.supergreen.cc
All endpoints accept JSON request bodies and return JSON responses. Make sure to set the Content-Type: application/json header.
// Install the client (optional)// npm install node-fetchconst fetch = require('node-fetch');const API_BASE = 'https://api.supergreen.cc';const YOUR_TOKEN = 'your-secret-token-here';const YOUR_PHONE = 'your-whatsapp-number';async function sendMessage(toNumber, message) {const response = await fetch(API_BASE, {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({endpoint: 'sendMessage',payload: {fromNumber: YOUR_PHONE,toNumber: toNumber,message: message,linkPreview: false,token: YOUR_TOKEN}})});return response.json();}// Example usagesendMessage('972501234567@c.us', 'Hello from Node.js!').then(result => console.log('Message sent:', result)).catch(err => console.error('Error:', err));
https://api.supergreen.cc/sendMessageSend a text message to any WhatsApp number or group.
fromNumber (string)*requiredtoNumber (string)*requiredmessage (string)*requiredlinkPreview (boolean)*requiredtoken (string)*requiredmessageId (string){"fromNumber": "972501234567","toNumber": "972509876543@c.us","message": "Hello! This is a test message.","linkPreview": false,"token": "your-secret-token"}
{"messageId": "3EB0123456789ABCDEF"}
https://api.supergreen.cc/sendMediaSend images, videos, or documents with optional caption to any WhatsApp number or group.
fromNumber (string)*requiredtoNumber (string)*requiredbase64 (string)*requiredtype (string)*requiredmimeType (string)filename (string)caption (string)token (string)*requiredmessageId (string){"fromNumber": "972501234567","toNumber": "972509876543@c.us","base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==","type": "image","caption": "Check out this image!","token": "your-secret-token"}
{"messageId": "3EB0987654321FEDCBA"}
https://api.supergreen.cc/editMessageEdit a previously sent message.
fromNumber (string)*requiredmessageId (string)*requirednewText (string)*requiredtoken (string)*requiredsuccess (boolean){"fromNumber": "972501234567","messageId": "3EB0123456789ABCDEF","newText": "Updated message text","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/sendTypingIndicationShow the 'typing...' indicator in a chat to make your bot feel more human.
fromNumber (string)*requiredchatId (string)*requireddurationMs (number)token (string)*requiredsuccess (boolean){"fromNumber": "972501234567","chatId": "972509876543@c.us","durationMs": 3000,"token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/stopTypingIndicationStop showing the 'typing...' indicator in a chat.
fromNumber (string)*requiredchatId (string)*requiredtoken (string)*requiredsuccess (boolean){"fromNumber": "972501234567","chatId": "972509876543@c.us","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/getGroupsRetrieve a list of WhatsApp groups. Set adminOnly to true to return only groups where your account is an admin.
fromNumber (string)*requiredadminOnly (boolean)token (string)*requiredgroups (array){"fromNumber": "972501234567","adminOnly": true,"token": "your-secret-token"}
{"groups": [{"id": "120363123456789012@g.us","name": "My Cool Group"},{"id": "120363987654321098@g.us","name": "Another Group"}]}
https://api.supergreen.cc/addUserToWhatsAppGroupAdd a user to a WhatsApp group where you are an admin.
fromNumber (string)*requiredgroupId (string)*requireduserId (string)*requiredtoken (string)*requiredsuccess (boolean){"fromNumber": "972501234567","groupId": "120363123456789012@g.us","userId": "972509876543@c.us","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/getCommonWhatsappGroupsGet a list of WhatsApp groups that both you and another user are members of.
fromNumber (string)*requireduserId (string)*requiredtoken (string)*requiredgroups (array){"fromNumber": "972501234567","userId": "972509876543@c.us","token": "your-secret-token"}
{"groups": [{"id": "120363123456789012@g.us","name": "Shared Group"}]}
https://api.supergreen.cc/getWhatsappJoinRequestsGet pending join requests for a group where you are an admin.
fromNumber (string)*requiredgroupId (string)*requiredtoken (string)*requiredrequests (array){"fromNumber": "972501234567","groupId": "120363123456789012@g.us","token": "your-secret-token"}
{"requests": [{"requesterId": "972509876543@c.us","addedById": null,"parentGroupId": null,"method": "non_admin_add","timestamp": 1703251200000}]}
https://api.supergreen.cc/approveWhatsappJoinRequestsApprove one or more pending join requests for a group.
fromNumber (string)*requiredgroupId (string)*requiredrequesterIds (array | null)token (string)*requiredresults (array){"fromNumber": "972501234567","groupId": "120363123456789012@g.us","requesterIds": ["972509876543@c.us"],"token": "your-secret-token"}
{"results": [{"requesterId": "972509876543@c.us","error": null,"message": "Approved successfully"}]}
https://api.supergreen.cc/rejectWhatsappJoinRequestsReject one or more pending join requests for a group.
fromNumber (string)*requiredgroupId (string)*requiredrequesterIds (array | null)token (string)*requiredresults (array){"fromNumber": "972501234567","groupId": "120363123456789012@g.us","requesterIds": ["972509876543@c.us"],"token": "your-secret-token"}
{"results": [{"requesterId": "972509876543@c.us","error": null,"message": "Rejected successfully"}]}
https://api.supergreen.cc/getGroupMembersGet all members of a WhatsApp group, including their admin status. Member IDs may be LID format (e.g., '12345@lid') instead of phone numbers depending on the account's addressing mode. Use the Convert LID to Number endpoint to resolve LIDs to phone numbers.
fromNumber (string)*requiredgroupId (string)*requiredtoken (string)*requiredmembers (array){"fromNumber": "972501234567","groupId": "120363123456789012@g.us","token": "your-secret-token"}
{"members": [{"id": "972509876543@c.us","isAdmin": true,"isSuperAdmin": true},{"id": "972501111111@c.us","isAdmin": false,"isSuperAdmin": false}]}
https://api.supergreen.cc/getWhatsappGroupDetailsGet details about a WhatsApp group using its invite link, including group name, description, size, and participants.
fromNumber (string)*requiredgroupLink (string)*requiredtoken (string)*requiredsuccess (boolean)id (string)subject (string)desc (string)size (number)participants (array){"fromNumber": "972501234567","groupLink": "https://chat.whatsapp.com/AbCdEfGhIjK","token": "your-secret-token"}
{"success": true,"id": "120363123456789012@g.us","subject": "My Group","desc": "Group description","size": 42,"participants": [{"id": "972509876543@c.us","isAdmin": true,"isSuperAdmin": false}]}
https://api.supergreen.cc/blockContactBlock a WhatsApp contact.
fromNumber (string)*requiredcontactId (string)*requiredtoken (string)*requiredsuccess (boolean){"fromNumber": "972501234567","contactId": "972509876543@c.us","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/unblockContactUnblock a previously blocked WhatsApp contact.
fromNumber (string)*requiredcontactId (string)*requiredtoken (string)*requiredsuccess (boolean){"fromNumber": "972501234567","contactId": "972509876543@c.us","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/convertLidToNumberConvert a WhatsApp LID (Linked ID) to a phone number. Some accounts use LID addressing mode where user IDs appear as '12345@lid' instead of phone numbers. This endpoint resolves them.
fromNumber (string)*requiredlid (string)*requiredtoken (string)*requirednumber (string | null){"fromNumber": "972501234567","lid": "119846817792023@lid","token": "your-secret-token"}
{"number": "972509876543@c.us"}
https://api.supergreen.cc/setWebhookSet or update the webhook URL to receive incoming messages and events.
phoneNumber (string)*requiredurl (string | null)*requiredtoken (string)*required{"phoneNumber": "972501234567","url": "https://your-server.com/webhook","token": "your-secret-token"}
{}
https://api.supergreen.cc/reconnectManually trigger a reconnection of your WhatsApp account.
number (string)*requiredtoken (string)*required{"number": "972501234567","token": "your-secret-token"}
{}
https://api.supergreen.cc/triggerCodeLoginRequest a pairing code for linking your WhatsApp account.
number (string)*requiredtoken (string)*required{"number": "972501234567","token": "your-secret-token"}
{}
https://api.supergreen.cc/clearCredentialsClear all stored credentials for your WhatsApp account. Use this to reset authentication.
phoneNumber (string)*requiredtoken (string)*requiredsuccess (boolean)error (string){"phoneNumber": "972501234567","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/changeWhatsappAccountNameChange the display name of your WhatsApp account.
phoneNumber (string)*requiredname (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","name": "My Business Bot","token": "your-secret-token"}
{}
https://api.supergreen.cc/changeWhatsappAccountAvatarChange the profile picture of your WhatsApp account.
phoneNumber (string)*requiredimageBase64 (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","imageBase64": "/9j/4AAQSkZJRg...","token": "your-secret-token"}
{}
https://api.supergreen.cc/deleteAccountPermanently delete a WhatsApp account from Supergreen. This stops the container, removes session data, and deletes the account record.
phoneNumber (string)*requiredtoken (string)*requiredsuccess (boolean){"phoneNumber": "972501234567","token": "your-secret-token"}
{"success": true}
When you configure a webhook URL, Supergreen will send POST requests to your server whenever messages or events are received. The webhook payload follows this structure:
{"network": "whatsapp","chat": {"id": "972509876543@c.us","username": "John Doe","title": "Optional Group Title"},"author": {"id": "972509876543@c.us","username": "John Doe"},"text": "Hello! This is a message from a user.","time": 1703251200000}
All API endpoints return standard HTTP status codes. Successful requests return 200 OK. Errors return appropriate status codes with JSON error details:
{"error": "Authentication failed","message": "Invalid token provided"}
Common error codes: