Integrate Supergreen WhatsApp and Telegram automation into your application using our HTTP API. Facebook accounts are managed from the dashboard and deliver scraped group posts to configured webhooks.
All API endpoints require authentication using your account's secret token. You can find this token in your WhatsApp, Telegram, or Facebook 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));
When you configure a webhook URL, Supergreen will send POST requests to your server whenever WhatsApp or Telegram messages are received, or when Facebook group posts are scraped. The webhook payload follows this structure:
{"network": "telegram","chat": {"id": "-1001234567890","username": "example_channel","title": "Example Group"},"author": {"id": "123456789","username": "johndoe"},"text": "Hello! This is a message from a user.","time": 1703251200000}
https://api.supergreen.cc/sendMessageSend a text message to any WhatsApp number or group.
fromNumber (string)*requiredtoNumber (string)*requiredmessage (string)*requiredlinkPreview (boolean)*requiredquotedMessageId (string)token (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/sendPollSend a poll to a WhatsApp group.
fromNumber (string)*requiredtoNumber (string)*requiredname (string)*requiredchoices (array)*requiredselectableCount (number)token (string)*requiredmessageId (string){"fromNumber": "972501234567","toNumber": "120363123456789012@g.us","name": "What's your favorite color?","choices": ["Red","Blue","Green"],"token": "your-secret-token"}
{"messageId": "3EB0POLL56789ABCDEF"}
https://api.supergreen.cc/editMessageEdit a previously sent message.
fromNumber (string)*requiredmessageId (string)*requirednewText (string)*requiredtoken (string)*required{"fromNumber": "972501234567","messageId": "3EB0123456789ABCDEF","newText": "Updated message text","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/deleteMessageDelete a previously sent message.
fromNumber (string)*requiredchatId (string)*requiredmessageId (string)*requiredtoken (string)*required{"fromNumber": "972501234567","chatId": "972501234567@c.us","messageId": "3EB0123456789ABCDEF","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/sendReactionSend a reaction emoji to a message.
fromNumber (string)*requiredmessageId (string)*requiredreaction (string)*requiredtoken (string)*required{"fromNumber": "972501234567","messageId": "3EB0123456789ABCDEF","reaction": "👍","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)*required{"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)*required{"fromNumber": "972501234567","chatId": "972509876543@c.us","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/getGroupsRetrieve a list of WhatsApp groups with admin status for each group.
fromNumber (string)*requireduseCache (boolean)token (string)*requiredwarning (string)cacheMaxAgeSeconds (number)groups (array){"fromNumber": "972501234567","token": "your-secret-token"}
{"groups": [{"id": "120363123456789012@g.us","name": "My Cool Group","isAdmin": true},{"id": "120363987654321098@g.us","name": "Another Group","isAdmin": false}]}
https://api.supergreen.cc/addUserToWhatsAppGroupAdd a user to a WhatsApp group where you are an admin.
groupId (string)*requireduserId (string)*requiredfromNumber (string)*requiredtoken (string)*required{"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)*requiredtoken (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 convertLidToNumber 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)*requiredid (string)subject (string)desc (string)size (number)owner (string)isInGroup (boolean)announce (boolean)restrict (boolean)creation (number)suspended (boolean)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/getGroupInviteLinkGet the invite link for a WhatsApp group.
fromNumber (string)*requiredgroupId (string)*requiredtoken (string)*requiredinviteLink (string | null){"fromNumber": "972501234567","groupId": "120363123456789012@g.us","token": "your-secret-token"}
{"inviteLink": null}
https://api.supergreen.cc/joinGroupByInviteLinkJoin a WhatsApp group using its invite link.
fromNumber (string)*requiredgroupLink (string)*requiredtoken (string)*requiredstatus (string)chatId (string){"fromNumber": "972501234567","groupLink": "https://chat.whatsapp.com/AbCdEfGhIjK","token": "your-secret-token"}
{"status": "joined","chatId": "120363123456789012@g.us"}
https://api.supergreen.cc/blockContactBlock a WhatsApp contact.
fromNumber (string)*requiredcontactId (string)*requiredtoken (string)*required{"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)*required{"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/addWebhookAdd an additional webhook URL to receive incoming messages and events. Each account can have multiple webhook URLs — events will be sent to all of them.
phoneNumber (string)*requiredurl (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","url": "https://your-server.com/webhook","token": "your-secret-token"}
{}
https://api.supergreen.cc/removeWebhookRemove a webhook URL from the account. If the URL matches the legacy webhook field, that is also cleared.
phoneNumber (string)*requiredurl (string)*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. The login method (QR code vs pairing code) is determined by the account's preferCodeLogin setting — use setLoginMethod to change it before reconnecting.
number (string)*requiredtoken (string)*required{"number": "972501234567","token": "your-secret-token"}
{}
https://api.supergreen.cc/setLoginMethodSet whether the account should use a pairing code or QR code when reconnecting. When preferCodeLogin is true, the next reconnect will generate a pairing code instead of a QR code.
phoneNumber (string)*requiredpreferCodeLogin (boolean)*requiredtoken (string)*required{"phoneNumber": "972501234567","preferCodeLogin": true,"token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/clearCredentialsClear all stored credentials for your WhatsApp account. Use this to reset authentication.
phoneNumber (string)*requiredtoken (string)*required{"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/changeWhatsappAccountBioChange the bio/about text of your WhatsApp account.
phoneNumber (string)*requiredbio (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","bio": "Powered by Supergreen","token": "your-secret-token"}
{}
https://api.supergreen.cc/submitTelegramCodeSubmit the login code to complete Telegram authentication.
phoneNumber (string)*requiredcode (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","code": "12345","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/sendTelegramMessageSend a text message via Telegram.
phoneNumber (string)*requiredchatId (string)*requiredtext (string)*requiredtoken (string)*requiredmessageId (string){"phoneNumber": "972501234567","chatId": "@example_channel","text": "Hello from Supergreen Telegram!","token": "your-secret-token"}
{"success": true,"messageId": "12345"}
https://api.supergreen.cc/getTelegramGroupsRetrieve a list of Telegram groups and channels.
phoneNumber (string)*requiredtoken (string)*requiredwarning (string)cacheMaxAgeSeconds (number)groups (array){"phoneNumber": "972501234567","token": "your-secret-token"}
{"success": true,"warning": "Group list is computed live and may be incomplete for large accounts.","cacheMaxAgeSeconds": 0,"groups": [{"id": "-1001234567890","name": "My Telegram Group","isAdmin": true}]}
https://api.supergreen.cc/joinTelegramGroupJoin a Telegram group or channel by username.
phoneNumber (string)*requiredgroupUsername (string)*requiredtoken (string)*requiredstatus (string)chatId (string){"phoneNumber": "972501234567","groupUsername": "example_channel","token": "your-secret-token"}
{"success": true,"status": "joined","chatId": "example_channel"}
https://api.supergreen.cc/setTelegramWebhookSet or update the webhook URL for a Telegram account.
phoneNumber (string)*requiredurl (string | null)*requiredtoken (string)*required{"phoneNumber": "972501234567","url": "https://your-server.com/telegram-webhook","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/addTelegramWebhookAdd an additional webhook URL for a Telegram account.
phoneNumber (string)*requiredurl (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","url": "https://your-server.com/telegram-webhook","token": "your-secret-token"}
{"success": true}
https://api.supergreen.cc/removeTelegramWebhookRemove a webhook URL from a Telegram account.
phoneNumber (string)*requiredurl (string)*requiredtoken (string)*required{"phoneNumber": "972501234567","url": "https://your-server.com/telegram-webhook","token": "your-secret-token"}
{"success": true}
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: