# Supergreen API Documentation Supergreen is a multi-platform automation and account management service for WhatsApp, Telegram, Facebook, Instagram, LinkedIn, and Virtual Phone Numbers. It provides a programmatic API to interact with connected accounts and automate messaging, group monitoring, and post publishing. ## Getting Started All API endpoints require authentication using your account's secret token. You can find this token in your 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. ## Hosted WhatsApp MCP Server Connect any MCP-compatible AI agent or client directly to your hosted WhatsApp line over Streamable HTTP — no local bridge or self-hosting required: - **Endpoint (Bearer auth):** `POST https://api.supergreen.cc/mcp` with header `Authorization: Bearer ` - **Endpoint (URL token for custom connectors):** `https://api.supergreen.cc/mcp/` - **Read-only mode:** Append `?readonly=1` to either URL to expose only read/search tools and block all outbound sends and edits. - **Setup guide:** https://supergreen.cc/mcp ## Data & Privacy Model (Pass-Through Infrastructure) Supergreen operates as a real-time pass-through conduit and does **not** maintain a central archive of your conversations or read, analyze, sell, or train AI models on message content: - **Real-time webhook delivery:** Incoming messages, reactions, edits, deletes, group membership updates, and connection lifecycle events are forwarded immediately to your configured webhook URL(s). Persist webhook events on your own server if you need long-term conversation history. - **Temporary media delivery URLs (7 days):** Incoming voice notes and media attachments include a signed `fileUri` valid for 7 days so webhooks receive lightweight JSON payloads; cached media objects are automatically deleted after expiry. - **Isolated recent sync buffer (7 days):** Each active WhatsApp line maintains only an isolated local linked-device sync buffer (auto-pruned after 7 days and wiped on session unpair) required by the messaging protocol for quoting, edits, decryption retries, recent `getMessages` lookups, and opt-in group thread reconstruction (`listThreads` / `getThread`). ## Webhook Events When you configure a webhook URL (`setWebhook` / `addWebhook`), Supergreen sends signed `POST` requests (`x-supergreen-signature: sha256=` using your account's `secretToken`) whenever messages or connection lifecycle events occur. Every webhook payload is a discriminated union keyed by the `event` field: - `"message"`, `"edit"`, `"delete"`, `"reaction"`, `"vote"`: Message and interaction updates (`fromMe` is `true` when sent from the connected line itself, `false` when incoming). Replies automatically include `quotedMessage` (`{ messageId, author, text, time }`) when the quoted message is in the 7-day local buffer. When opt-in group threading is enabled (`setGroupThreading`), group `"message"` / `"edit"` events also include `threadId` and `thread` (`{ id, viewerUrl, decision, relatedMsgId?, messages }`). - `"participant_joined"`, `"participant_left"`: Group membership updates (`participants` array). - `"disconnected"`, `"connected"`, `"banned"`: Connection status updates sent to the same webhook URLs (after a 30-second reconnect grace period on transient drops so brief worker restarts do not trigger false alerts). Filter on `event === "disconnected"` in Make, n8n, or your server to alert when a line needs attention. ## WhatsApp Group Threading & Thread Viewer Busy WhatsApp and Telegram groups often interleave multiple unrelated discussions at once. Opt-in group thread resolution separates concurrent group discussions into stable conversation threads: - **Enable thread resolution:** - **WhatsApp:** Call `POST /setGroupThreading` with `{ "phoneNumber": "...", "enabled": true, "token": "..." }`, or toggle **Group thread resolution** under the line's **Advanced** section in the dashboard. - **Telegram:** Call `POST /setTelegramGroupThreading` with `{ "phoneNumber": "...", "enabled": true, "token": "..." }`, or toggle **Group thread resolution** under the Telegram line's **Advanced** section. - Thread resolution runs on incoming and outgoing group messages even if no webhook URL is configured. - **How threads are assigned:** Quoted replies and Telegram Forum Topics resolve deterministically via the quote chain (instant and free); unquoted group messages use a fast decision model up to the monthly fair-use cap while skipping standalone greetings. - **Dedicated Thread Viewer & Deep Links:** Any WhatsApp or Telegram line with thread resolution enabled gets a dedicated **Threads** page (`https://supergreen.cc/threads/` for WhatsApp, `https://supergreen.cc/threads/telegram/` for Telegram) accessible from the **Open Threads** / **View Threads** button on the line card, with group filtering, keyword/author/ID search, grouped chat bubbles with Markdown formatting, cached avatars, inline quote previews, copyable `threadId` and deep link, and on-demand full-thread loading. Every threaded webhook (`thread.viewerUrl`), `listThreads`/`listTelegramThreads`, and `getThread`/`getTelegramThread` response includes a direct deep link (`https://supergreen.cc/threads//` for WhatsApp, `https://supergreen.cc/threads/telegram//` for Telegram) that opens that exact thread on a dedicated distraction-free page for any signed-in admin of the line (enforced by dashboard permissions). - **Retrieve threads via API:** - `POST /listThreads` / `POST /listTelegramThreads` — list recent reconstructed threads ordered by most recent message, optionally filtered by `chatId` or `query`. - `POST /getThread` / `POST /getTelegramThread` — retrieve a single reconstructed thread and its full message history by `threadId` (with optional `chatId` and `count`, up to 200 messages). - `POST /getMessages` / `POST /getTelegramMessages` with `threadId` — paginate messages belonging to a specific thread inside a group chat. ## Telegram Parity & Frictionless Onboarding Telegram accounts support the full messaging, media, group, webhook, and threading feature set on par with WhatsApp: - **Frictionless login:** Sign in with a **QR Code** (scan in Telegram → Settings → Devices → Link Desktop Device) or an **in-app login code**, with full **2FA Cloud Password** support (`submitTelegramPassword`). Custom `my.telegram.org` `apiId`/`apiHash` credentials are optional when server defaults are configured. - **Full webhook parity:** Configure and test webhooks with `setTelegramWebhook`, `addTelegramWebhook`, `removeTelegramWebhook`, and `testTelegramWebhook`. Receives signed `"message"` (with `attachments`, `quotedMessage`, `threadId`, `thread`), `"edit"`, `"delete"`, `"reaction"`, `"vote"`, `"participant_joined"`, `"participant_left"`, `"connected"`, and `"disconnected"` events. - **Full messaging & group operations:** `sendTelegramMessage` (with quote/reply & linkPreview), `sendTelegramMedia`, `sendTelegramPoll`, `editTelegramMessage`, `deleteTelegramMessage`, `sendTelegramReaction`, `sendTelegramTypingIndication`, `stopTelegramTypingIndication`, `getTelegramMessages`, `listTelegramChats`, `searchTelegramContacts`, `searchTelegramMessages`, `getTelegramGroups`, `joinTelegramGroup` (username or private `t.me/+...` invite link), `getTelegramGroupMembers`, `addUserToTelegramGroup`, `removeUserFromTelegramGroup`, `getTelegramGroupInviteLink`, `blockTelegramContact`, `unblockTelegramContact`, and profile updates (`changeTelegramAccountName`, `changeTelegramAccountBio`, `changeTelegramAccountAvatar`). **Message event example:** ```json { "event": "message", "network": "whatsapp", "phoneNumber": "15551234567", "messageId": "3EB0123456789ABCDEF", "fromMe": false, "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 } ``` **Connection status event example (`"disconnected"` | `"connected"` | `"banned"`):** ```json { "event": "disconnected", "network": "whatsapp", "phoneNumber": "15551234567", "chat": { "id": "15551234567" }, "author": { "id": "15551234567" }, "text": "", "time": 1703251200000 } ``` ## Endpoints ### sendMessage **POST** `/sendMessage` Send a text message to any WhatsApp number or group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `toNumber` *string* (Required): Recipient's WhatsApp ID (e.g., '972501234567@c.us' for individuals or 'group-id@g.us' for groups) - `message` *string* (Required): The text message to send - `linkPreview` *boolean* (Required): Whether to show link previews for URLs in the message - `quotedMessageId` *string*: ID of a message to quote/reply to - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "fromNumber": "15551234567", "toNumber": "15559876543@c.us", "message": "Hello! This is a test message.", "linkPreview": false, "token": "your-secret-token" } ``` **Response:** ```json { "messageId": "3EB0123456789ABCDEF" } ``` ### sendMedia **POST** `/sendMedia` Send images, videos, or documents with optional caption to any WhatsApp number or group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `toNumber` *string* (Required): Recipient's WhatsApp ID - `base64` *string*: Base64 encoded media data (with or without data URL prefix) - `url` *string*: Public HTTP/HTTPS URL of the media file to send - `type` *string* (Required): Media type: 'image', 'video', 'document', or 'audio' - `mimeType` *string*: Media MIME type (e.g., 'image/jpeg', 'video/mp4', 'application/pdf'). Auto-detected from data URL if not provided - `filename` *string*: Filename for the media. Auto-generated from MIME type if not provided - `caption` *string*: Optional caption text for the media - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "fromNumber": "15551234567", "toNumber": "15559876543@c.us", "base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", "type": "image", "caption": "Check out this image!", "token": "your-secret-token" } ``` **Response:** ```json { "messageId": "3EB0987654321FEDCBA" } ``` ### sendContact **POST** `/sendContact` Send a contact card (vCard) to any WhatsApp number or group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `toNumber` *string* (Required): Recipient's WhatsApp ID (e.g., '972501234567@c.us' for individuals or 'group-id@g.us' for groups) - `contactId` *string* (Required): Contact's WhatsApp ID or phone number (e.g., '972509876543@c.us' or '972509876543') - `name` *string* (Required): Display name of the contact - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "fromNumber": "15551234567", "toNumber": "15559876543@c.us", "contactId": "15550001111@c.us", "name": "Jane Doe", "token": "your-secret-token" } ``` **Response:** ```json { "messageId": "3EB0CONTACT56789ABCDEF" } ``` ### sendPoll **POST** `/sendPoll` Send a poll to a WhatsApp group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `toNumber` *string* (Required): Group ID to send the poll to (e.g., '120363123456789012@g.us') - `name` *string* (Required): The poll question/title - `choices` *array* (Required): Array of poll options (minimum 2) - `selectableCount` *number*: How many options a voter may select (default: 1) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "fromNumber": "15551234567", "toNumber": "120363123456789012@g.us", "name": "What's your favorite color?", "choices": [ "Red", "Blue", "Green" ], "token": "your-secret-token" } ``` **Response:** ```json { "messageId": "3EB0POLL56789ABCDEF" } ``` ### sendInteractiveResponse **POST** `/sendInteractiveResponse` Reply to a WhatsApp interactive button, list, template button, or native flow menu by selecting one of its options. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `toNumber` *string* (Required): Recipient's WhatsApp ID (e.g., '972501234567@c.us') - `quotedMessageId` *string* (Required): ID of the interactive button, list, template button, or native flow message being answered - `kind` *string* (Required): Interactive menu kind: 'buttons', 'list', 'template_buttons', or 'native_flow' - `selectedId` *string* (Required): The buttonId, rowId, or template button id of the selected option - `selectedDisplayText` *string* (Required): The visible label/title of the selected option - `selectedDescription` *string*: Optional description of the selected list row - `selectedIndex` *integer*: 0-based button index when answering a template_buttons message - `nativeFlowName` *string*: Native flow button name (e.g., 'quick_reply' or 'single_select') when kind is 'native_flow' - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "fromNumber": "15551234567", "toNumber": "15559876543@c.us", "quotedMessageId": "false_15559876543@c.us_3EB0MENU123456", "kind": "buttons", "selectedId": "btn_support", "selectedDisplayText": "Talk to support", "token": "your-secret-token" } ``` **Response:** ```json { "messageId": "3EB0RESP56789ABCDEF" } ``` ### editMessage **POST** `/editMessage` Edit a previously sent message. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `messageId` *string* (Required): ID of the message to edit (returned from sendMessage) - `newText` *string* (Required): The new text for the message - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "messageId": "3EB0123456789ABCDEF", "newText": "Updated message text", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### deleteMessage **POST** `/deleteMessage` Delete a previously sent message. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `chatId` *string* (Required): Chat ID (e.g. 972501234567@c.us for 1:1 or groupId@g.us for group) - `messageId` *string* (Required): ID of the message to delete - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "chatId": "15551234567@c.us", "messageId": "3EB0123456789ABCDEF", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### sendReaction **POST** `/sendReaction` Send a reaction emoji to a message. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `messageId` *string* (Required): ID of the message to react to - `reaction` *string* (Required): Reaction emoji to send - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "messageId": "3EB0123456789ABCDEF", "reaction": "👍", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### sendTypingIndication **POST** `/sendTypingIndication` Show the 'typing...' indicator in a chat to make your bot feel more human. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `chatId` *string* (Required): Chat ID where typing indicator should appear - `durationMs` *number*: Duration in milliseconds (optional, defaults to standard duration) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "chatId": "15559876543@c.us", "durationMs": 3000, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### stopTypingIndication **POST** `/stopTypingIndication` Stop showing the 'typing...' indicator in a chat. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `chatId` *string* (Required): Chat ID where typing indicator should stop - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "chatId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### getMessages **POST** `/getMessages` Retrieve recent messages from a WhatsApp conversation or group via the active line's isolated 7-day sync buffer (Supergreen is pass-through infrastructure with no central message archive; use webhooks for permanent storage). **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `chatId` *string* (Required): Chat ID to fetch messages from (e.g., '972501234567@c.us', '120363123456789012@g.us', or bare phone number) - `count` *integer*: Number of messages to return (default: 20, max: 200) - `id` *string*: Message ID cursor for pagination - `fromMe` *boolean*: Filter by whether messages were sent by you - `direction` *string*: Fetch messages 'before' or 'after' the given message ID (default: 'before') - `threadId` *string*: Optional reconstructed group thread ID to filter messages to that thread - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messages` *array*: **Request:** ```json { "fromNumber": "15551234567", "chatId": "15559876543@c.us", "count": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messages": [ { "id": "false_15559876543@c.us_3EB0123456789ABCDEF", "chatId": "15559876543@c.us", "authorId": "15559876543@c.us", "authorName": "John Doe", "text": "Hey, are we still on for today?", "time": 1703251200000, "fromMe": false, "type": "chat" } ] } ``` ### listChats **POST** `/listChats` List recent WhatsApp chats (1:1 and groups) ordered by most recent activity from the active line's isolated 7-day sync buffer. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `limit` *integer*: Maximum number of recent chats to return (default: 20, max: 100) - `query` *string*: Optional case-insensitive filter matched against chat name, phone number, or last message text - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `chats` *array*: **Request:** ```json { "fromNumber": "15551234567", "limit": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "chats": [ { "id": "15559876543@c.us", "name": "John Doe", "isGroup": false, "lastMessageText": "Hey, are we still on for today?", "lastMessageTime": 1703251200000, "lastMessageFromMe": false } ] } ``` ### listThreads **POST** `/listThreads` List reconstructed WhatsApp group conversation threads ordered by most recent message from the active line's isolated 7-day buffer (requires group threading enabled via setGroupThreading). **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `chatId` *string*: Optional group chat ID ('...@g.us') to filter threads to a single group - `limit` *integer*: Maximum number of reconstructed group threads to return ordered by most recent message (default: 30, max: 100) - `messagesPerThread` *integer*: Maximum number of recent messages to include per thread (default: 20, max: 50) - `query` *string*: Optional case-insensitive filter matched against group name, chat ID, thread ID, author, or message text - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `threads` *array*: **Request:** ```json { "fromNumber": "15551234567", "chatId": "120363123456789012@g.us", "limit": 30, "messagesPerThread": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "threads": [ { "id": "b1f8c4d2-1234-4a56-8b90-abcdef123456", "chatId": "120363123456789012@g.us", "chatName": "Product Builders", "viewerUrl": "https://supergreen.cc/threads/15551234567/b1f8c4d2-1234-4a56-8b90-abcdef123456", "messageCount": 2, "firstMessageAt": 1742000000000, "lastMessageAt": 1742000060000, "messages": [ { "id": "false_120363123456789012@g.us_3EB012345678", "authorId": "15559876543@c.us", "authorName": "Alice", "text": "Anyone tested the new release?", "time": 1742000000000, "fromMe": false }, { "id": "false_120363123456789012@g.us_3EB012345679", "authorId": "15551112222@c.us", "authorName": "Bob", "text": "Yes, running smoothly so far.", "time": 1742000060000, "fromMe": false, "quotedMessageId": "false_120363123456789012@g.us_3EB012345678" } ] } ] } ``` ### getThread **POST** `/getThread` Retrieve a single reconstructed WhatsApp group conversation thread and its messages by threadId from the active line's isolated 7-day buffer. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `threadId` *string* (Required): Reconstructed WhatsApp group thread ID (from webhook threadId / thread.id, listThreads, or the dashboard Thread Viewer) - `chatId` *string*: Optional group chat ID ('...@g.us') to scope the lookup; omit to retrieve by threadId alone - `count` *integer*: Maximum number of messages to return in the thread (default: 50, max: 200) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `thread` *object*: **Request:** ```json { "fromNumber": "15551234567", "threadId": "b1f8c4d2-1234-4a56-8b90-abcdef123456", "count": 50, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "thread": { "id": "b1f8c4d2-1234-4a56-8b90-abcdef123456", "chatId": "120363123456789012@g.us", "chatName": "Product Builders", "viewerUrl": "https://supergreen.cc/threads/15551234567/b1f8c4d2-1234-4a56-8b90-abcdef123456", "messageCount": 2, "firstMessageAt": 1742000000000, "lastMessageAt": 1742000060000, "messages": [ { "id": "false_120363123456789012@g.us_3EB012345678", "authorId": "15559876543@c.us", "authorName": "Alice", "text": "Anyone tested the new release?", "time": 1742000000000, "fromMe": false }, { "id": "false_120363123456789012@g.us_3EB012345679", "authorId": "15551112222@c.us", "authorName": "Bob", "text": "Yes, running smoothly so far.", "time": 1742000060000, "fromMe": false, "quotedMessageId": "false_120363123456789012@g.us_3EB012345678" } ] } } ``` ### searchContacts **POST** `/searchContacts` Search WhatsApp contacts and groups by name or phone number to find their chat ID. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `query` *string* (Required): Name, pushname, or phone number substring to search for - `limit` *integer*: Maximum number of matching contacts/groups to return (default: 20, max: 50) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `contacts` *array*: **Request:** ```json { "fromNumber": "15551234567", "query": "John", "limit": 10, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "contacts": [ { "id": "15559876543@c.us", "name": "John Doe", "pushname": "John", "isGroup": false } ] } ``` ### searchMessages **POST** `/searchMessages` Search recent WhatsApp messages containing a text query in the active line's isolated 7-day sync buffer, optionally scoped to one chat. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `query` *string* (Required): Case-insensitive text substring to search for in recent messages - `chatId` *string*: Optional chat ID to restrict search to a single conversation or group - `limit` *integer*: Maximum number of matching messages to return (default: 20, max: 100) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messages` *array*: **Request:** ```json { "fromNumber": "15551234567", "query": "dinner", "limit": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messages": [ { "id": "false_15559876543@c.us_3EB0123456789ABCDEF", "chatId": "15559876543@c.us", "authorId": "15559876543@c.us", "authorName": "John Doe", "text": "Are we still on for dinner tonight?", "time": 1703251200000, "fromMe": false, "type": "chat" } ] } ``` ### getGroups **POST** `/getGroups` Retrieve a list of WhatsApp groups with admin status for each group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `useCache` *boolean*: Whether to use cached group metadata (defaults to true). Set to false for a fresh fetch. - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `warning` *string*: - `cacheMaxAgeSeconds` *number*: - `groups` *array*: **Request:** ```json { "fromNumber": "15551234567", "token": "your-secret-token" } ``` **Response:** ```json { "groups": [ { "id": "120363123456789012@g.us", "name": "My Cool Group", "isAdmin": true }, { "id": "120363987654321098@g.us", "name": "Another Group", "isAdmin": false } ] } ``` ### addUserToWhatsAppGroup **POST** `/addUserToWhatsAppGroup` Add a user to a WhatsApp group where you are an admin. **Authentication:** Required - Include token in request body **Request Body:** - `groupId` *string* (Required): Group ID (e.g., '120363123456789012@g.us') - `userId` *string* (Required): User ID to add (e.g., '972509876543@c.us') - `fromNumber` *string* (Required): Your WhatsApp account phone number - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "userId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### removeUserFromWhatsAppGroup **POST** `/removeUserFromWhatsAppGroup` Remove a user from a WhatsApp group where you are an admin. **Authentication:** Required - Include token in request body **Request Body:** - `groupId` *string* (Required): Group ID (e.g., '120363123456789012@g.us') - `userId` *string* (Required): User ID to remove (e.g., '972509876543@c.us') - `fromNumber` *string* (Required): Your WhatsApp account phone number - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "userId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### getCommonWhatsappGroups **POST** `/getCommonWhatsappGroups` Get a list of WhatsApp groups that both you and another user are members of. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `userId` *string* (Required): User ID to check common groups with - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `groups` *array*: **Request:** ```json { "fromNumber": "15551234567", "userId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "groups": [ { "id": "120363123456789012@g.us", "name": "Shared Group" } ] } ``` ### getWhatsappJoinRequests **POST** `/getWhatsappJoinRequests` Get pending join requests for a group where you are an admin. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupId` *string* (Required): Group ID to check for join requests - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `requests` *array*: **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "token": "your-secret-token" } ``` **Response:** ```json { "requests": [ { "requesterId": "15559876543@c.us", "addedById": null, "parentGroupId": null, "method": "non_admin_add", "timestamp": 1703251200000 } ] } ``` ### approveWhatsappJoinRequests **POST** `/approveWhatsappJoinRequests` Approve one or more pending join requests for a group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupId` *string* (Required): Group ID where requests should be approved - `requesterIds` *array | null*: Array of requester IDs to approve, or null to approve all - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `results` *array*: **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "requesterIds": [ "15559876543@c.us" ], "token": "your-secret-token" } ``` **Response:** ```json { "results": [ { "requesterId": "15559876543@c.us", "error": null, "message": "Approved successfully" } ] } ``` ### rejectWhatsappJoinRequests **POST** `/rejectWhatsappJoinRequests` Reject one or more pending join requests for a group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupId` *string* (Required): Group ID where requests should be rejected - `requesterIds` *array* (Required): Array of requester IDs to reject - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `results` *array*: **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "requesterIds": [ "15559876543@c.us" ], "token": "your-secret-token" } ``` **Response:** ```json { "results": [ { "requesterId": "15559876543@c.us", "error": null, "message": "Rejected successfully" } ] } ``` ### getGroupMembers **POST** `/getGroupMembers` Get 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. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupId` *string* (Required): Group ID (e.g., '120363123456789012@g.us') - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `members` *array*: **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "token": "your-secret-token" } ``` **Response:** ```json { "members": [ { "id": "15559876543@c.us", "isAdmin": true, "isSuperAdmin": true }, { "id": "15551111111@c.us", "isAdmin": false, "isSuperAdmin": false } ] } ``` ### getWhatsappGroupDetails **POST** `/getWhatsappGroupDetails` Get details about a WhatsApp group using its invite link, including group name, description, size, and participants. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupLink` *string* (Required): WhatsApp group invite link (e.g., 'https://chat.whatsapp.com/AbCdEfGhIjK') - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `id` *string*: - `subject` *string*: - `desc` *string*: - `size` *number*: - `owner` *string*: - `isInGroup` *boolean*: - `announce` *boolean*: - `restrict` *boolean*: - `creation` *number*: - `suspended` *boolean*: - `participants` *array*: **Request:** ```json { "fromNumber": "15551234567", "groupLink": "https://chat.whatsapp.com/AbCdEfGhIjK", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "id": "120363123456789012@g.us", "subject": "My Group", "desc": "Group description", "size": 42, "participants": [ { "id": "15559876543@c.us", "isAdmin": true, "isSuperAdmin": false } ] } ``` ### getGroupInviteLink **POST** `/getGroupInviteLink` Get the invite link for a WhatsApp group. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupId` *string* (Required): Group ID to get the invite link for - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `inviteLink` *string | null*: **Request:** ```json { "fromNumber": "15551234567", "groupId": "120363123456789012@g.us", "token": "your-secret-token" } ``` **Response:** ```json { "inviteLink": null } ``` ### joinGroupByInviteLink **POST** `/joinGroupByInviteLink` Join a WhatsApp group using its invite link. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `groupLink` *string* (Required): WhatsApp group invite link to join - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `status` *string*: - `chatId` *string*: **Request:** ```json { "fromNumber": "15551234567", "groupLink": "https://chat.whatsapp.com/AbCdEfGhIjK", "token": "your-secret-token" } ``` **Response:** ```json { "status": "joined", "chatId": "120363123456789012@g.us" } ``` ### blockContact **POST** `/blockContact` Block a WhatsApp contact. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `contactId` *string* (Required): Contact ID to block (e.g., '972509876543@c.us') - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "contactId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### reportContact **POST** `/reportContact` Report a contact/sender to WhatsApp as spam. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `contactId` *string* (Required): Contact ID to report as spam (e.g., '972509876543@c.us') - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "contactId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### unblockContact **POST** `/unblockContact` Unblock a previously blocked WhatsApp contact. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `contactId` *string* (Required): Contact ID to unblock (e.g., '972509876543@c.us') - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "fromNumber": "15551234567", "contactId": "15559876543@c.us", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### convertLidToNumber **POST** `/convertLidToNumber` Convert 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. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `lid` *string* (Required): LID to resolve (e.g., '119846817792023@lid') - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `number` *string | null*: **Request:** ```json { "fromNumber": "15551234567", "lid": "119846817792023@lid", "token": "your-secret-token" } ``` **Response:** ```json { "number": "15559876543@c.us" } ``` ### checkWhatsappNumber **POST** `/checkWhatsappNumber` Check whether a phone number has an active WhatsApp account. **Authentication:** Required - Include token in request body **Request Body:** - `fromNumber` *string* (Required): Your WhatsApp account phone number - `targetNumber` *string* (Required): Phone number to check in international format (e.g., '972501234567' or '+972501234567') - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `exists` *boolean*: - `jid` *string | null*: - `number` *string | null*: - `isBusiness` *boolean*: **Request:** ```json { "fromNumber": "15551234567", "targetNumber": "15559876543", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "exists": true, "jid": "15559876543@c.us", "number": "15559876543" } ``` ### setWebhook **POST** `/setWebhook` Set or update the webhook URL to receive incoming messages and events. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `url` *string | null* (Required): Webhook URL to receive updates, or null to remove webhook - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/webhook", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### addWebhook **POST** `/addWebhook` Add 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. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `url` *string* (Required): Webhook URL to add - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/webhook", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### removeWebhook **POST** `/removeWebhook` Remove a webhook URL from the account. If the URL matches the legacy webhook field, that is also cleared. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `url` *string* (Required): Webhook URL to remove - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/webhook", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### reconnect **POST** `/reconnect` Manually 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. **Authentication:** Required - Include token in request body **Request Body:** - `number` *string* (Required): Your WhatsApp account phone number - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "number": "15551234567", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### setLoginMethod **POST** `/setLoginMethod` Set 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. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `preferCodeLogin` *boolean* (Required): Set to true for pairing code login, false for QR code login - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "preferCodeLogin": true, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### setGroupThreading **POST** `/setGroupThreading` Enable or disable opt-in WhatsApp group conversation threading across all groups on the line. Quote-chain resolution is instant and free; unquoted group messages use a fast decision model up to the monthly fair-use cap. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `enabled` *boolean* (Required): Set to true to enable opt-in WhatsApp group thread reconstruction across all groups on this line (attaches threadId and thread.messages to group webhooks and threadId to getMessages) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "enabled": true, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### clearCredentials **POST** `/clearCredentials` Clear all stored credentials for your WhatsApp account. Use this to reset authentication. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### changeWhatsappAccountName **POST** `/changeWhatsappAccountName` Change the display name of your WhatsApp account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `name` *string* (Required): The new display name for your WhatsApp account - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "name": "My Business Bot", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### changeWhatsappAccountAvatar **POST** `/changeWhatsappAccountAvatar` Change the profile picture of your WhatsApp account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `imageBase64` *string* (Required): Base64-encoded JPEG image. Can optionally include data URI prefix (data:image/jpeg;base64,...) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "imageBase64": "/9j/4AAQSkZJRg...", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### changeWhatsappAccountBio **POST** `/changeWhatsappAccountBio` Change the bio/about text of your WhatsApp account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `bio` *string* (Required): The new bio/about text for your account - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "bio": "Powered by Supergreen", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### changeWhatsappPrivacySettings **POST** `/changeWhatsappPrivacySettings` Change the privacy settings of your WhatsApp account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your WhatsApp account phone number - `category` *string* (Required): The privacy category to update ('about' or 'profilePic') - `value` *string* (Required): Who can see this information ('all' for Everyone, 'contacts' for My Contacts, 'none' for Nobody) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "category": "about", "value": "all", "token": "your-secret-token" } ``` **Response:** ```json {} ``` ### submitTelegramCode **POST** `/submitTelegramCode` **Authentication:** Required - Include refreshToken in request body (injected automatically by call_supergreen_user_api) **Request Body:** - `refreshToken` *string* (Required): - `phoneNumber` *string* (Required): - `code` *string* (Required): **Request:** ```json { "phoneNumber": "15551234567", "code": "12345", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "needsPassword": false } ``` ### submitTelegramPassword **POST** `/submitTelegramPassword` **Authentication:** Required - Include refreshToken in request body (injected automatically by call_supergreen_user_api) **Request Body:** - `refreshToken` *string* (Required): - `phoneNumber` *string* (Required): - `password` *string* (Required): **Request:** ```json { "phoneNumber": "15551234567", "password": "your-telegram-2fa-password", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### reconnectTelegram **POST** `/reconnectTelegram` Reconnect a Telegram account or restart the login flow (QR code or login code). **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `preferQrLogin` *boolean*: Optionally override login method for this reconnect (true for QR code, false for login code) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "preferQrLogin": true, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### setTelegramLoginMethod **POST** `/setTelegramLoginMethod` Set whether a Telegram account uses QR code scan or in-app login code when authenticating. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `preferQrLogin` *boolean* (Required): Set to true for QR code login (scan in Telegram -> Devices -> Link Desktop Device), false for in-app login code - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "preferQrLogin": true, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### clearTelegramCredentials **POST** `/clearTelegramCredentials` Log out and clear stored Telegram session credentials and local sync buffer for this account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### sendTelegramMessage **POST** `/sendTelegramMessage` Send a text message via Telegram, optionally replying to a message. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID, @username, or t.me link to send to (e.g., '-1001234567890' or '@example_channel') - `text` *string* (Required): Message text - `quotedMessageId` *string*: Optional Telegram message ID to reply/quote - `linkPreview` *boolean*: Whether to show link previews for URLs in the message - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "phoneNumber": "15551234567", "chatId": "@example_channel", "text": "Hello from Supergreen Telegram!", "quotedMessageId": "42", "linkPreview": false, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messageId": "12345" } ``` ### sendTelegramMedia **POST** `/sendTelegramMedia` Send images, videos, audio/voice notes, or documents to any Telegram chat or group. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID or @username to send media to - `base64` *string*: Base64 encoded media data (with or without data URL prefix) - `url` *string*: Public HTTP/HTTPS URL of the media file to send - `type` *string* (Required): Media type: 'image', 'video', 'document', or 'audio' - `mimeType` *string*: Media MIME type (e.g., 'image/jpeg', 'video/mp4', 'application/pdf') - `filename` *string*: Filename for the media attachment - `caption` *string*: Optional caption text for the media - `quotedMessageId` *string*: Optional Telegram message ID to reply to - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "url": "https://example.com/photo.jpg", "type": "image", "caption": "Check this out!", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messageId": "12346" } ``` ### sendTelegramPoll **POST** `/sendTelegramPoll` Send a poll to a Telegram group or chat. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Telegram chat or group ID - `name` *string* (Required): The poll question/title - `choices` *array* (Required): Array of poll options (2 to 10 options) - `selectableCount` *number*: Set > 1 to allow multiple answers (default: 1) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messageId` *string*: **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "name": "Where should we meet?", "choices": [ "Tel Aviv", "New York", "Remote" ], "selectableCount": 1, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messageId": "12347" } ``` ### editTelegramMessage **POST** `/editTelegramMessage` Edit a previously sent Telegram message. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID or @username containing the message - `messageId` *string* (Required): ID of the message to edit - `newText` *string* (Required): The new text for the message - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "messageId": "12345", "newText": "Updated message text!", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### deleteTelegramMessage **POST** `/deleteTelegramMessage` Delete a Telegram message for everyone (where permitted). **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID or @username containing the message - `messageId` *string* (Required): ID of the message to delete - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "messageId": "12345", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### sendTelegramReaction **POST** `/sendTelegramReaction` Send an emoji reaction to a Telegram message. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID or @username containing the message - `messageId` *string* (Required): ID of the message to react to - `reaction` *string* (Required): Reaction emoji to send (or empty string to remove reaction) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "messageId": "12345", "reaction": "👍", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### sendTelegramTypingIndication **POST** `/sendTelegramTypingIndication` Show the 'typing...' indicator in a Telegram chat. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID where typing indicator should appear - `durationMs` *number*: Optional duration in milliseconds before automatically cancelling typing status - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "durationMs": 4000, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### stopTelegramTypingIndication **POST** `/stopTelegramTypingIndication` Stop showing the 'typing...' indicator in a Telegram chat. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID where typing indicator should stop - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### getTelegramMessages **POST** `/getTelegramMessages` Retrieve recent messages from a Telegram conversation or group, optionally filtered by reconstructed threadId. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string* (Required): Chat ID or @username to fetch messages from - `count` *integer*: Number of messages to return (default: 20, max: 200) - `id` *string*: Message ID cursor for pagination - `fromMe` *boolean*: Filter by whether messages were sent by you - `direction` *string*: Fetch messages 'before' or 'after' the given message ID (default: 'before') - `threadId` *string*: Optional reconstructed group thread ID to filter messages to that thread - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messages` *array*: **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "count": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messages": [ { "id": "12345", "chatId": "-1001234567890", "authorId": "987654321", "authorName": "Alice", "text": "Hello everyone!", "time": 1703251200000, "fromMe": false, "type": "chat" } ] } ``` ### listTelegramChats **POST** `/listTelegramChats` List recent Telegram chats (DMs, groups, and channels) ordered by most recent activity. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `limit` *integer*: Maximum number of recent chats to return (default: 20, max: 100) - `query` *string*: Optional case-insensitive filter matched against chat name, ID, or last message text - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `chats` *array*: **Request:** ```json { "phoneNumber": "15551234567", "limit": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "chats": [ { "id": "-1001234567890", "name": "My Telegram Group", "isGroup": true, "lastMessageText": "Hello everyone!", "lastMessageTime": 1703251200000, "lastMessageFromMe": false, "unreadCount": 0 } ] } ``` ### searchTelegramContacts **POST** `/searchTelegramContacts` Search Telegram contacts, users, groups, and channels to find their chat ID. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `query` *string* (Required): Name, @username, phone number, or ID substring to search for - `limit` *integer*: Maximum number of matching contacts/groups to return (default: 20, max: 50) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `contacts` *array*: **Request:** ```json { "phoneNumber": "15551234567", "query": "Alice", "limit": 10, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "contacts": [ { "id": "987654321", "name": "Alice Cohen", "pushname": "alice", "isGroup": false } ] } ``` ### searchTelegramMessages **POST** `/searchTelegramMessages` Search Telegram messages containing a text query, optionally scoped to one chat. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `query` *string* (Required): Case-insensitive text query to search for in messages - `chatId` *string*: Optional chat ID or @username to restrict search to one conversation or group - `limit` *integer*: Maximum number of matching messages to return (default: 20, max: 100) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `messages` *array*: **Request:** ```json { "phoneNumber": "15551234567", "query": "launch", "chatId": "-1001234567890", "limit": 20, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "messages": [ { "id": "12345", "chatId": "-1001234567890", "authorId": "987654321", "authorName": "Alice", "text": "Ready for launch!", "time": 1703251200000, "fromMe": false, "type": "chat" } ] } ``` ### setTelegramGroupThreading **POST** `/setTelegramGroupThreading` Enable or disable opt-in Telegram group conversation threading across all groups on the line. Quote-chain and forum-topic resolution is instant and free; unquoted group messages use a fast decision model up to the monthly fair-use cap. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `enabled` *boolean* (Required): Set to true to enable opt-in Telegram group thread reconstruction across all groups on this line (attaches threadId and thread.messages to group webhooks and enables listTelegramThreads/getTelegramThread) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "enabled": true, "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### listTelegramThreads **POST** `/listTelegramThreads` List reconstructed Telegram group conversation threads ordered by most recent message from the account's isolated 7-day buffer (requires group threading enabled via setTelegramGroupThreading). **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `chatId` *string*: Optional Telegram group ID (e.g. '-1001234567890') to filter threads to a single group - `limit` *integer*: Maximum number of reconstructed group threads to return ordered by most recent message (default: 30, max: 100) - `messagesPerThread` *integer*: Maximum number of recent messages to include per thread (default: 20, max: 50) - `query` *string*: Optional case-insensitive filter matched against group name, chat ID, thread ID, author, or message text - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `threads` *array*: **Request:** ```json { "phoneNumber": "15551234567", "chatId": "-1001234567890", "limit": 20, "messagesPerThread": 15, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "threads": [ { "id": "7b2a9d20-5e7c-4d34-9b14-75a45f03e3a1", "chatId": "-1001234567890", "chatName": "My Telegram Group", "viewerUrl": "https://supergreen.cc/threads/telegram/15551234567/7b2a9d20-5e7c-4d34-9b14-75a45f03e3a1", "messageCount": 2, "firstMessageAt": 1703251200000, "lastMessageAt": 1703251260000, "messages": [ { "id": "100", "authorId": "987654321", "authorName": "Alice", "text": "Are we shipping today?", "time": 1703251200000, "fromMe": false }, { "id": "101", "authorId": "123456789", "authorName": "Bob", "text": "Yes, rolling out now!", "time": 1703251260000, "fromMe": false, "quotedMessageId": "100" } ] } ] } ``` ### getTelegramThread **POST** `/getTelegramThread` Retrieve a single reconstructed Telegram group conversation thread and its messages by threadId. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `threadId` *string* (Required): Reconstructed Telegram group thread ID (from webhook threadId / thread.id, listTelegramThreads, or the Thread Viewer) - `chatId` *string*: Optional Telegram group ID to scope the lookup; omit to retrieve by threadId alone - `count` *integer*: Maximum number of messages to return in the thread (default: 50, max: 200) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `thread` *object*: **Request:** ```json { "phoneNumber": "15551234567", "threadId": "7b2a9d20-5e7c-4d34-9b14-75a45f03e3a1", "count": 50, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "thread": { "id": "7b2a9d20-5e7c-4d34-9b14-75a45f03e3a1", "chatId": "-1001234567890", "chatName": "My Telegram Group", "viewerUrl": "https://supergreen.cc/threads/telegram/15551234567/7b2a9d20-5e7c-4d34-9b14-75a45f03e3a1", "messageCount": 2, "firstMessageAt": 1703251200000, "lastMessageAt": 1703251260000, "messages": [ { "id": "100", "authorId": "987654321", "authorName": "Alice", "text": "Are we shipping today?", "time": 1703251200000, "fromMe": false } ] } } ``` ### getTelegramGroups **POST** `/getTelegramGroups` Retrieve a list of Telegram groups and channels with admin status. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `warning` *string*: - `cacheMaxAgeSeconds` *number*: - `groups` *array*: **Request:** ```json { "phoneNumber": "15551234567", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "warning": "", "cacheMaxAgeSeconds": 0, "groups": [ { "id": "-1001234567890", "name": "My Telegram Group", "isAdmin": true } ] } ``` ### joinTelegramGroup **POST** `/joinTelegramGroup` Join a Telegram group or channel by username or invite link. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `groupUsername` *string* (Required): Group/channel @username, t.me link, or private invite link (https://t.me/+...) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `status` *string*: - `chatId` *string*: **Request:** ```json { "phoneNumber": "15551234567", "groupUsername": "https://t.me/+AbCdEf123456", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "status": "joined", "chatId": "-1001234567890" } ``` ### getTelegramGroupMembers **POST** `/getTelegramGroupMembers` Get members of a Telegram group or supergroup along with their admin status. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `groupId` *string* (Required): Telegram group ID or @username - `limit` *integer*: Maximum number of members to return (default: 200, max: 500) - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `members` *array*: **Request:** ```json { "phoneNumber": "15551234567", "groupId": "-1001234567890", "limit": 100, "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "members": [ { "id": "987654321", "name": "Alice Cohen", "pushname": "alice", "isAdmin": true, "isSuperAdmin": true } ] } ``` ### addUserToTelegramGroup **POST** `/addUserToTelegramGroup` Add a user to a Telegram group where you have permission. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `groupId` *string* (Required): Telegram group ID or @username - `userId` *string* (Required): User ID or @username to add - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "groupId": "-1001234567890", "userId": "@alice", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### removeUserFromTelegramGroup **POST** `/removeUserFromTelegramGroup` Remove a user from a Telegram group where you are an admin. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `groupId` *string* (Required): Telegram group ID or @username - `userId` *string* (Required): User ID or @username to remove - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "groupId": "-1001234567890", "userId": "@alice", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### getTelegramGroupInviteLink **POST** `/getTelegramGroupInviteLink` Get or export an invite link for a Telegram group. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `groupId` *string* (Required): Telegram group ID or @username - `token` *string* (Required): Your account's secret authentication token **Response Body:** - `inviteLink` *string | null*: **Request:** ```json { "phoneNumber": "15551234567", "groupId": "-1001234567890", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "inviteLink": "https://t.me/+AbCdEf123456" } ``` ### blockTelegramContact **POST** `/blockTelegramContact` Block a Telegram user. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `contactId` *string* (Required): User ID or @username to block - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "contactId": "@spammer", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### unblockTelegramContact **POST** `/unblockTelegramContact` Unblock a previously blocked Telegram user. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `contactId` *string* (Required): User ID or @username to unblock - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "contactId": "@spammer", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### setTelegramWebhook **POST** `/setTelegramWebhook` Set or update the webhook URL for a Telegram account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `url` *string | null* (Required): Webhook URL to receive updates, or null to remove webhook - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/telegram-webhook", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### addTelegramWebhook **POST** `/addTelegramWebhook` Add an additional webhook URL for a Telegram account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `url` *string* (Required): Webhook URL to add - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/telegram-webhook", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### removeTelegramWebhook **POST** `/removeTelegramWebhook` Remove a webhook URL from a Telegram account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `url` *string* (Required): Webhook URL to remove - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/telegram-webhook", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### testTelegramWebhook **POST** `/testTelegramWebhook` Send a signed test Telegram webhook event to verify your endpoint receives and verifies Supergreen payloads. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `url` *string* (Required): Webhook URL to send a signed test event to - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "url": "https://your-server.com/telegram-webhook", "token": "your-secret-token" } ``` **Response:** ```json { "success": true, "status": 200 } ``` ### changeTelegramAccountName **POST** `/changeTelegramAccountName` Change the display name of your Telegram account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `name` *string* (Required): New display name for your Telegram account - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "name": "Supergreen Support", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### changeTelegramAccountBio **POST** `/changeTelegramAccountBio` Change the bio/about text of your Telegram account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `bio` *string* (Required): New bio/about text for your Telegram account - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "bio": "Automated assistant powered by Supergreen", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### changeTelegramAccountAvatar **POST** `/changeTelegramAccountAvatar` Change the profile photo of your Telegram account. **Authentication:** Required - Include token in request body **Request Body:** - `phoneNumber` *string* (Required): Your Telegram account phone number - `imageBase64` *string* (Required): Base64-encoded JPEG/PNG image (with or without data URI prefix) - `token` *string* (Required): Your account's secret authentication token **Request:** ```json { "phoneNumber": "15551234567", "imageBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRg==", "token": "your-secret-token" } ``` **Response:** ```json { "success": true } ``` ### addAccountAdmin **POST** `/addAccountAdmin` Share a line/account with a teammate by adding their email as a co-admin (+ Add Admin). Co-admins can view and operate the shared line from their own Supergreen login without consuming an extra billing slot. The invited email must have signed in at https://supergreen.cc at least once first. **Authentication:** Required - Include refreshToken in request body (injected automatically by call_supergreen_user_api) **Request Body:** - `refreshToken` *string* (Required): Dashboard session token (injected automatically by call_supergreen_user_api) - `accountId` *string* (Required): Account UUID (or normalized phone number for WhatsApp, Telegram, or SMS phone lines) - `email` *string* (Required): Email address of the teammate to add as co-admin (must have logged in at https://supergreen.cc at least once first) - `accountType` *string*: Account entity type: 'whatsapp' (default), 'telegram', 'facebook', 'instagram', 'reddit', 'linkedin', or 'phone' **Request:** ```json { "refreshToken": "your-session-refresh-token", "accountId": "142ed1c4-bc61-4a65-acab-3d7e69b3292d", "email": "teammate@example.com", "accountType": "whatsapp" } ``` **Response:** ```json { "success": true } ``` ### removeAccountAdmin **POST** `/removeAccountAdmin` Remove a co-admin from a shared line/account. Neither the billing owner (billingUser) nor the last remaining admin can be removed. **Authentication:** Required - Include refreshToken in request body (injected automatically by call_supergreen_user_api) **Request Body:** - `refreshToken` *string* (Required): Dashboard session token (injected automatically by call_supergreen_user_api) - `accountId` *string* (Required): Account UUID (or normalized phone number for WhatsApp, Telegram, or SMS phone lines) - `adminId` *string*: Optional user ID of the co-admin to remove (provide adminId or email) - `email` *string*: Email address of the co-admin to remove - `accountType` *string*: Account entity type: 'whatsapp' (default), 'telegram', 'facebook', 'instagram', 'reddit', 'linkedin', or 'phone' **Request:** ```json { "refreshToken": "your-session-refresh-token", "accountId": "142ed1c4-bc61-4a65-acab-3d7e69b3292d", "email": "teammate@example.com", "accountType": "whatsapp" } ``` **Response:** ```json { "success": true } ``` ### addFbGroup **POST** `/addFbGroup` **Authentication:** Required - Include refreshToken in request body (injected automatically by call_supergreen_user_api) **Request Body:** - `refreshToken` *string* (Required): - `fbAccountId` *string* (Required): - `groupId` *string* (Required): - `name` *string*: **Request:** ```json { "refreshToken": "your-user-session-token", "fbAccountId": "fb-account-12345", "groupId": "123456789", "name": "Tech Enthusiasts" } ``` **Response:** ```json { "success": true } ``` ### removeFbGroup **POST** `/removeFbGroup` **Authentication:** Required - Include refreshToken in request body (injected automatically by call_supergreen_user_api) **Request Body:** - `refreshToken` *string* (Required): - `fbGroupId` *string* (Required): **Request:** ```json { "refreshToken": "your-user-session-token", "fbGroupId": "fb-group-12345" } ``` **Response:** ```json { "success": true } ``` ### commentOnFbPost **POST** `/commentOnFbPost` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `fbAccountId` *string*: Facebook Account ID. Optional when using token (the token already identifies the account). Never an email address - `groupId` *string* (Required): - `postId` *string* (Required): - `text` *string* (Required): **Request:** ```json { "token": "your-secret-token", "fbAccountId": "fb-account-12345", "groupId": "123456789", "postId": "987654321", "text": "Great post!" } ``` **Response:** ```json { "success": true } ``` ### postToFbGroup **POST** `/postToFbGroup` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `fbAccountId` *string*: Facebook Account ID. Optional when using token (the token already identifies the account). Never an email address - `groupId` *string* (Required): Facebook Group ID or URL - `post` *string*: Post text content - `text` *string*: Post text content alias - `async` *boolean*: If true, returns an operationId immediately and processes in background **Request:** ```json { "token": "your-secret-token", "groupId": "123456789", "post": "Hello Facebook group! This is an automated post." } ``` **Response:** ```json { "success": true } ``` ### getFbGroups **POST** `/getFbGroups` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `fbAccountId` *string*: Facebook Account ID. Optional when using token (the token already identifies the account). Never an email address - `refresh` *boolean*: If true, scrapes joined groups live from Facebook - `async` *boolean*: If true, runs live refresh in background and returns an operationId immediately **Request:** ```json { "token": "your-secret-token", "refresh": false } ``` **Response:** ```json { "success": true, "groups": [ { "id": "fb-group-1", "groupId": "123456789", "name": "Tech Enthusiasts", "lastScrapedAt": 1700000000000 } ] } ``` ### getFbOperation **POST** `/getFbOperation` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `operationId` *string* (Required): Operation ID returned from an async request **Request:** ```json { "token": "your-secret-token", "operationId": "op_fb_123456789" } ``` **Response:** ```json { "success": true, "operationId": "op_fb_123456789", "status": "completed", "result": { "success": true } } ``` ### sendFbDirectMessage **POST** `/sendFbDirectMessage` Send a direct message on Facebook Messenger using the connected Facebook account. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `fbAccountId` *string*: Facebook Account ID. Optional when using token (the token already identifies the account). Never an email address - `recipientUserId` *string* (Required): Numeric Facebook user/thread ID or Messenger thread URL (e.g. '100012345678901' or 'https://www.facebook.com/messages/t/100012345678901/') - `text` *string* (Required): The text message to send - `async` *boolean*: If true, returns an operationId immediately and sends in background (poll with getFbOperation) **Request:** ```json { "token": "your-secret-token", "recipientUserId": "100012345678901", "text": "Hello from Supergreen!" } ``` **Response:** ```json { "success": true } ``` ### getFbDirectMessages **POST** `/getFbDirectMessages` Read recent Facebook Messenger inbox conversations, or read messages from a specific Messenger thread/user. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `fbAccountId` *string*: Facebook Account ID. Optional when using token (the token already identifies the account). Never an email address - `conversationId` *string*: Numeric Facebook Messenger thread/user ID or Messenger thread URL (e.g. '100012345678901' or 'https://www.facebook.com/messages/t/100012345678901/'). Omit to list recent inbox conversations. - `recipientUserId` *string*: Alias for conversationId (numeric Facebook user/thread ID or Messenger URL). - `limit` *number*: Maximum number of messages or inbox conversations to fetch (default: 20, max: 50) - `async` *boolean*: If true, runs in background and returns an operationId immediately (poll with getFbOperation) **Request:** ```json { "token": "your-secret-token", "conversationId": "100012345678901", "limit": 20 } ``` **Response:** ```json { "success": true, "threadId": "100012345678901", "participantName": "Jane Doe", "messages": [ { "senderName": "Jane Doe", "text": "Hi! Is this still available?", "time": "10:42 AM", "isFromMe": false }, { "senderName": "You", "text": "Yes, happy to share details!", "time": "10:45 AM", "isFromMe": true } ] } ``` ### scanFbMarketplace **POST** `/scanFbMarketplace` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Facebook account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires fbAccountId - `fbAccountId` *string*: Facebook Account ID. Optional when using token (the token already identifies the account). Never an email address - `query` *string* (Required): - `minPrice` *number*: - `maxPrice` *number*: - `limit` *number*: - `maxScrolls` *number*: **Request:** ```json { "token": "your-secret-token", "query": "laptops", "minPrice": 300, "maxPrice": 1500 } ``` **Response:** ```json { "success": true, "listings": [ { "itemId": "1360403449376994", "title": "Lenovo ThinkPad T14 Gen 2", "price": "$500", "location": "San Francisco, CA", "itemUrl": "https://www.facebook.com/marketplace/item/1360403449376994/", "imageUrl": "https://scontent-atl3-3.xx.fbcdn.net/v/..." } ] } ``` ### addLinkedInConnection **POST** `/addLinkedInConnection` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the LinkedIn account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires linkedInAccountId - `linkedInAccountId` *string*: LinkedIn Account ID. Optional when using token (the token already identifies the account). Never an email address - `profileUrl` *string* (Required): LinkedIn profile URL or vanity username (e.g. 'https://www.linkedin.com/in/satyanadella' or 'satyanadella') - `message` *string*: Optional personalized invitation note (up to 300 characters) **Request:** ```json { "token": "your-secret-token", "profileUrl": "https://www.linkedin.com/in/satyanadella", "message": "Hi Satya, I would love to connect!" } ``` **Response:** ```json { "success": true, "status": "invitation_sent", "connected": false } ``` ### searchLinkedInPeople **POST** `/searchLinkedInPeople` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the LinkedIn account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires linkedInAccountId - `linkedInAccountId` *string*: LinkedIn Account ID. Optional when using token (the token already identifies the account). Never an email address - `query` *string* (Required): Search query keywords - `limit` *number*: Maximum results (default 10) - `page` *number*: Search page number (default 1) **Request:** ```json { "token": "your-secret-token", "query": "software engineer google", "limit": 10 } ``` **Response:** ```json { "success": true, "results": [ { "name": "Jane Doe", "headline": "Staff Software Engineer at Google", "location": "San Francisco Bay Area", "profileUrl": "https://www.linkedin.com/in/janedoe", "connectionDegree": "2nd", "actionText": "Connect" } ] } ``` ### sendLinkedInMessage **POST** `/sendLinkedInMessage` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the LinkedIn account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires linkedInAccountId - `linkedInAccountId` *string*: LinkedIn Account ID. Optional when using token (the token already identifies the account). Never an email address - `profileUrl` *string*: LinkedIn profile URL or vanity username to message - `conversationId` *string*: LinkedIn conversation / thread ID - `text` *string* (Required): The text message to send **Request:** ```json { "token": "your-secret-token", "profileUrl": "https://www.linkedin.com/in/janedoe", "text": "Hi Jane, great connecting with you!" } ``` **Response:** ```json { "success": true, "sent": true } ``` ### getLinkedInMessages **POST** `/getLinkedInMessages` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the LinkedIn account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires linkedInAccountId - `linkedInAccountId` *string*: LinkedIn Account ID. Optional when using token (the token already identifies the account). Never an email address - `conversationId` *string*: Conversation / thread ID. If omitted and profileUrl is omitted, returns inbox conversations list - `profileUrl` *string*: Profile URL or username to get messages with - `limit` *number*: Maximum number of messages or conversations to fetch **Request:** ```json { "token": "your-secret-token", "limit": 20 } ``` **Response:** ```json { "success": true, "conversations": [ { "threadId": "2-YmZmNDkyMGUt...", "participantName": "Jane Doe", "participantProfileUrl": "https://www.linkedin.com/in/janedoe", "lastMessage": "Sounds good, talk soon!", "lastMessageTime": "2h", "unread": false } ] } ``` ### getLinkedInProfile **POST** `/getLinkedInProfile` **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the LinkedIn account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires linkedInAccountId - `linkedInAccountId` *string*: LinkedIn Account ID. Optional when using token (the token already identifies the account). Never an email address - `profileUrl` *string* (Required): LinkedIn profile URL or vanity username **Request:** ```json { "token": "your-secret-token", "profileUrl": "https://www.linkedin.com/in/satyanadella" } ``` **Response:** ```json { "success": true, "profile": { "name": "Satya Nadella", "headline": "Chairman and CEO at Microsoft", "about": "Leading Microsoft's mission to empower every person...", "location": "Greater Seattle Area", "connectionDegree": "2nd", "followerCount": "10M+ followers", "profileUrl": "https://www.linkedin.com/in/satyanadella" } } ``` ### createLinkedInPost **POST** `/createLinkedInPost` Create and publish a new post on your LinkedIn feed. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the LinkedIn account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires linkedInAccountId - `linkedInAccountId` *string*: LinkedIn Account ID. Optional when using token (the token already identifies the account). Never an email address - `text` *string* (Required): The text content of the LinkedIn post - `visibility` *string*: Optional post visibility: 'ANYONE' (public) or 'CONNECTIONS_ONLY' (1st-degree connections only). Defaults to the account's current LinkedIn setting **Request:** ```json { "token": "your-secret-token", "text": "Excited to share our latest product update!", "visibility": "ANYONE" } ``` **Response:** ```json { "success": true, "posted": true, "postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:7123456789012345678/" } ``` ### sendInstagramDirectMessage **POST** `/sendInstagramDirectMessage` Send a direct message on Instagram to a username or existing DM thread. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Instagram account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires instagramAccountId - `instagramAccountId` *string*: Instagram Account ID. Optional when using token (the token already identifies the account). Never an email address - `username` *string*: Recipient Instagram username or profile URL (e.g. 'natgeo', '@natgeo', or 'https://www.instagram.com/natgeo/') - `threadId` *string*: Instagram DM thread ID or Direct URL (e.g. '340282366841710300949128123456789012345' or 'https://www.instagram.com/direct/t/340282366841710300949128123456789012345/') - `conversationId` *string*: Alias for threadId - `text` *string* (Required): The text message to send **Request:** ```json { "token": "your-secret-token", "username": "natgeo", "text": "Hello from Supergreen!" } ``` **Response:** ```json { "success": true, "sent": true, "threadId": "340282366841710300949128123456789012345" } ``` ### getInstagramDirectMessages **POST** `/getInstagramDirectMessages` List recent Instagram DM inbox conversations, or read messages from a specific DM thread or user. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Instagram account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires instagramAccountId - `instagramAccountId` *string*: Instagram Account ID. Optional when using token (the token already identifies the account). Never an email address - `threadId` *string*: Instagram DM thread ID or Direct URL. Omit along with username to list recent inbox conversations. - `conversationId` *string*: Alias for threadId - `username` *string*: Instagram username or profile URL to read DM history with. - `limit` *integer*: Maximum number of conversations or messages to return (default: 20, max: 50) **Request:** ```json { "token": "your-secret-token", "limit": 20 } ``` **Response:** ```json { "success": true, "conversations": [ { "threadId": "340282366841710300949128123456789012345", "participantName": "Jane Doe", "participantUsername": "janedoe", "threadUrl": "https://www.instagram.com/direct/t/340282366841710300949128123456789012345/", "lastMessage": "Sounds good, talk soon!", "lastMessageTime": "2026-11-19T12:00:00.000Z", "isFromMe": false, "unread": false } ] } ``` ### createInstagramPost **POST** `/createInstagramPost` Publish a new photo or video post to your Instagram feed. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Instagram account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires instagramAccountId - `instagramAccountId` *string*: Instagram Account ID. Optional when using token (the token already identifies the account). Never an email address - `mediaUrl` *string*: Public HTTP/HTTPS URL of the image (JPEG/PNG/WebP) or video (MP4/MOV) to publish - `mediaBase64` *string*: Base64-encoded image or video data (with or without data: URL prefix) - `mimeType` *string*: Optional media MIME type (e.g. 'image/jpeg', 'image/png', 'video/mp4'). Auto-detected when omitted. - `filename` *string*: Optional filename for the media upload (e.g. 'photo.jpg') - `caption` *string*: Optional caption text for the Instagram feed post **Request:** ```json { "token": "your-secret-token", "mediaUrl": "https://example.com/photo.jpg", "caption": "Behind the scenes at Supergreen!" } ``` **Response:** ```json { "success": true, "posted": true, "postUrl": "https://www.instagram.com/p/Cx123456789/" } ``` ### createInstagramStory **POST** `/createInstagramStory` Publish a photo to your Instagram Story. **Authentication:** Required - Include token in request body **Request Body:** - `token` *string*: Secret API token of the Instagram account; identifies the account on its own - `refreshToken` *string*: Dashboard session token; requires instagramAccountId - `instagramAccountId` *string*: Instagram Account ID. Optional when using token (the token already identifies the account). Never an email address - `mediaUrl` *string*: Public HTTP/HTTPS URL of the image (JPEG/PNG/WebP) to publish as an Instagram Story - `mediaBase64` *string*: Base64-encoded image data (with or without data: URL prefix) - `mimeType` *string*: Optional image MIME type (e.g. 'image/jpeg', 'image/png', 'image/webp'). Auto-detected when omitted. - `filename` *string*: Optional filename for the story upload (e.g. 'story.jpg') **Request:** ```json { "token": "your-secret-token", "mediaUrl": "https://example.com/story.jpg" } ``` **Response:** ```json { "success": true, "posted": true } ```