### API Configuration Example Source: https://wasenderapi.com/api-docs/getting-started/model-context-protocol-mcp-integration Example configuration for connecting to the WasenderAPI. ```APIDOC ### Request Example ```json { "mcp": { "WasenderAPI": { "type": "remote", "url": "https://wasenderapi.com/mcp", "enabled": true, "headers": { "Authorization": "Bearer YOUR_PERSONAL_ACCESS_TOKEN" } } } } ``` ``` -------------------------------- ### Install Laravel SDK Source: https://wasenderapi.com/api-docs/developer-sdks/official-sdks-nodejs-python-laravel Use Composer to install the WasenderAPI Laravel package. ```bash composer require wasenderapi/wasenderapi-laravel ``` -------------------------------- ### Install Python SDK Source: https://wasenderapi.com/api-docs/developer-sdks/official-sdks-nodejs-python-laravel Use pip to install the WasenderAPI package for Python projects. ```bash pip install wasenderapi ``` -------------------------------- ### Install Node.js SDK Source: https://wasenderapi.com/api-docs/developer-sdks/official-sdks-nodejs-python-laravel Use npm to install the WasenderAPI package for Node.js projects. ```bash npm install wasenderapi ``` -------------------------------- ### cURL Upload Media File Examples Source: https://wasenderapi.com/api-docs/messages/upload-media-file Examples demonstrating how to upload media files using cURL. Supports both raw binary and JSON (Base64) encoded uploads. Ensure the Content-Type header is set correctly for raw binary uploads. ```bash # Raw Binary Upload (Recommended) curl -X POST "https://wasenderapi.com/api/upload" \ -H "Content-Type: image/jpeg" \ --data-binary "@path/to/your/image.jpg" ``` ```bash # JSON (Base64) Upload curl -X POST "https://wasenderapi.com/api/upload" \ -H "Content-Type: application/json" \ -d '{ "base64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQE..." }' ``` -------------------------------- ### Webhook Setup Source: https://wasenderapi.com/api-docs How to set up and verify webhooks to receive real-time events. ```APIDOC ## Webhook Setup ### Description How to set up and verify webhooks to receive real-time events. ### Method POST ### Endpoint `/your-webhook-url` ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/contacts/get-contact-profile-picture This is an example of a successful response when retrieving a contact's profile picture URL. ```json { "success": true, "data": { "imgUrl": "https:\/\/profile.pic.url\/image.jpg" } } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/channels-communities/send-channel-message This is an example of a successful response when sending a message to a WhatsApp channel. ```json { "success": true, "data": { "msgId": 100000, "jid": "+123456789", "status": "in_progress" } } ``` -------------------------------- ### Success Response for Get Session User Info Source: https://wasenderapi.com/api-docs/sessions/get-session-user-info Example of a successful response when retrieving session user information. The response includes the user's WhatsApp ID, name, and LID. ```json { "success": true, "data": { "id": "1234567890:42@s.whatsapp.net", "name": "Your WhatsApp Name", "lid": "Your LID" } } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/groups/get-group-invite-link This is an example of a successful response when retrieving a group invite link. It includes a boolean indicating success and the generated invite link. ```json { "success": true, "inviteLink": "https://chat.whatsapp.com/I8mjkHnC984Ubg3EVkzqxz" } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/sessions/get-whatsapp-session-qr-code Example of a successful response when retrieving a WhatsApp session QR code. The 'qrCode' field contains the string to be used for generating a QR code image. ```json { "success": true, "data": { "qrCode": "2@DfzdTHeYfa9/RMXr8A2IP3/....", // This is the QR string. Use a QR code library to generate an image. } } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/messages/get-message-info This is an example of a successful response when retrieving message information. It includes details like sender, receiver, message content, and status. ```json { "success": true, "data": { "remoteJid": "123456789@s.whatsapp.net", "id": "EN82FV0387IVR54JTE2R1", "msgId": 100000, "key": { "id": "EN82FV0387IVR54JTE2R1", "fromMe": true, "remoteJid": "123456789@s.whatsapp.net" }, "message": { "extendedTextMessage": { "text": "quoted", "contextInfo": { "stanzaId": "SNE5U4M5OSPWHXHN1WBGV", "participant": "123456789@s.whatsapp.net", "quotedMessage": { "extendedTextMessage": { "text": "quoted" } } } } }, "messageTimestamp": "1751297488", "status": 2 } } ``` -------------------------------- ### Webhook Setup Source: https://wasenderapi.com/api-docs/webhooks Configure and verify your webhook endpoint to receive real-time events from WasenderAPI. ```APIDOC ## POST /your-webhook-url ### Description This endpoint is used to set up and verify your webhook URL for receiving real-time events. ### Method POST ### Endpoint `/your-webhook-url` ### Request Body (Details not provided in the source text) ### Response (Details not provided in the source text) ``` -------------------------------- ### Validation Error Example Source: https://wasenderapi.com/api-docs/responses-errors/error-responses An example of a validation error response, indicating required fields were missing or invalid. ```json { "success": false, "message": "Validation failed", "errors": { "to": [ "The to field is required." ], "text": [ "The text field is required when no media is present." ] } } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/contacts/create-or-update-contact The JSON structure returned upon a successful contact creation or update. ```json { "success": true, "data": { "jid": "1234567890@s.whatsapp.net", "fullName": "John Doe" } } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/messages/send-view-once-message The JSON structure returned upon a successful API request. ```json { "success": true, "data": { "msgId": 100002, "jid": "1234567890@s.whatsapp.net", "status": "in_progress" } } ``` -------------------------------- ### Handle Unauthenticated Response Source: https://wasenderapi.com/api-docs/authentication/how-to-authenticate-api-requests-using-personal-access-token Example response returned when the API key is missing or invalid. ```json { "success": false, "message": "Unnotarized" } ``` -------------------------------- ### Success Response Example Source: https://wasenderapi.com/api-docs/groups/update-group-participants The JSON structure returned upon a successful update of group participant roles. ```json { "success": true, "data": { "participants": ["111111111@s.whatsapp.net"] } } ``` -------------------------------- ### GET /api/whatsapp-sessions/{whatsappSession} Source: https://wasenderapi.com/api-docs/sessions Retrieves details for a specific WhatsApp session. ```APIDOC ## GET /api/whatsapp-sessions/{whatsappSession} ### Description Retrieves details for a specific WhatsApp session. ### Method GET ### Endpoint /api/whatsapp-sessions/{whatsappSession} ### Parameters #### Path Parameters - **whatsappSession** (string) - Required - The unique identifier for the WhatsApp session. ``` -------------------------------- ### Success Response - QR Code Needed Source: https://wasenderapi.com/api-docs/sessions/connect-whatsapp-session Example JSON response when a session requires a QR code scan to connect. ```json { "success": true, "data": { "status": "NEED_SCAN", "qrCode": "2@DTMUHeYfa9/RMXr8A2IP3/...", // This is the QR string. Use a QR code library to generate an image expires after 45s call GetQrCode endpoint to generate a fresh one. } } ``` -------------------------------- ### Get WhatsApp Session Details Source: https://wasenderapi.com/api-docs/sessions/get-whatsapp-session-details Retrieves details for a specific WhatsApp session. Requires an access token in the Authorization header. ```bash curl "https://www.wasenderapi.com/api/whatsapp-sessions/{whatsappSession}" -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" ``` -------------------------------- ### GET /api/whatsapp-sessions/{whatsappSession}/qrcode Source: https://wasenderapi.com/api-docs/sessions Retrieves the QR code needed to connect a WhatsApp session. ```APIDOC ## GET /api/whatsapp-sessions/{whatsappSession}/qrcode ### Description Retrieves the QR code needed to connect a WhatsApp session with the WhatsApp client. Requires an active subscription. ### Method GET ### Endpoint /api/whatsapp-sessions/{whatsappSession}/qrcode ### Parameters #### Path Parameters - **whatsappSession** (string) - Required - The unique identifier for the WhatsApp session. ``` -------------------------------- ### WhatsApp Session Status Response Source: https://wasenderapi.com/api-docs/sessions/get-whatsapp-session-status Example JSON response indicating the current session status. ```json { "status":"connected" } ``` -------------------------------- ### Get All WhatsApp Sessions Source: https://wasenderapi.com/api-docs/sessions/get-all-whatsapp-sessions Retrieves a list of all WhatsApp sessions available to the authenticated user. Requires an access token in the Authorization header. ```bash curl "https://www.wasenderapi.com/api/whatsapp-sessions" -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" ``` -------------------------------- ### GET /api/whatsapp-sessions Source: https://wasenderapi.com/api-docs/sessions Retrieves a list of all WhatsApp sessions available to the authenticated user. ```APIDOC ## GET /api/whatsapp-sessions ### Description Retrieves a list of all WhatsApp sessions available to the authenticated user. ### Method GET ### Endpoint /api/whatsapp-sessions ``` -------------------------------- ### Get Message Info Request Source: https://wasenderapi.com/api-docs/messages/get-message-info Use this endpoint to retrieve detailed information about a specific message. Replace {msgId} with the actual message ID and YOUR_API_KEY with your authentication token. ```bash curl "https://www.wasenderapi.com/api/messages/{msgId}/info" -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Session Logs Success Response Source: https://wasenderapi.com/api-docs/sessions/get-session-logs Example of a successful paginated JSON response containing session event data. ```json { "success": true, "data": { "current_page": 1, "data": [ { "id": 201, "whatsapp_session_id": 1, "event_type": "session_restarted", "status":"connected", "occurred_at": "2025-09-23T12:00:00.000000Z" }, { "id": 200, "whatsapp_session_id": 1, "event_type": "status_change", "status": "need_scan", "occurred_at": "2025-09-23T11:59:30.000000Z" } ], "first_page_url": "/api/whatsapp-sessions/my-session-123/session-logs?page=1", "from": 1, "last_page": 3, "last_page_url": "/api/whatsapp-sessions/my-session-123/session-logs?page=3", "next_page_url": "/api/whatsapp-sessions/my-session-123/session-logs?page=2", "path": "/api/whatsapp-sessions/my-session-123/session-logs", "per_page": 2, "prev_page_url": null, "to": 2, "total": 6 } } ``` -------------------------------- ### Success Response for Group Creation Source: https://wasenderapi.com/api-docs/groups/create-a-new-group This is an example of a successful response when creating a new WhatsApp group. It includes the group ID, owner, subject, creation timestamp, and a list of participants with their admin status. ```json [ { "title": "Success Response", "code": { "success": true, "data": { "id": "123456789-987654321@g.us", "owner": "1122334455@s.whatsapp.net", "subject": "My New Group", "creation": 1678886400, "participants": [ { "id": "1122334455@s.whatsapp.net", "admin": "superadmin" }, { "id": "1234567890@s.whatsapp.net", "admin": null }, { "id": "0987654321@s.whatsapp.net", "admin": null } ] } } } ] ``` -------------------------------- ### Get WhatsApp Session QR Code Source: https://wasenderapi.com/api-docs/sessions/get-whatsapp-session-qr-code Retrieves the QR code for connecting a WhatsApp session. Requires an active subscription and an access token. Ensure the session is initialized first. ```bash curl "https://www.wasenderapi.com/api/whatsapp-sessions/{whatsappSession}/qrcode" -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" ``` -------------------------------- ### Update WhatsApp Session Success Response Source: https://wasenderapi.com/api-docs/sessions/update-whatsapp-session Example of a successful JSON response returned after updating a WhatsApp session. ```json { "success": true, "data": { "id": 1, "name": "Business WhatsApp", "phone_number": "+1234567890", "status": "connected", "account_protection": true, "log_messages": true, "read_incoming_messages": true, "webhook_url": "https://example.com/webhook", "webhook_enabled": true, "webhook_events": [ "messages.received", "session.status", "messages.update" ], "api_key": "75075a7bf6417bff59e76fb7205382c2dc74cf1769e76f382c2dc74cf176c0bf", "webhook_secret": "fb61be92ddb7935e0cedcec58e470f6c", "created_at": "2025-04-01T12:00:00Z", "updated_at": "2025-05-08T15:30:00Z" } } ``` -------------------------------- ### GET /api/whatsapp-sessions/{whatsappSession} Source: https://wasenderapi.com/api-docs/sessions/get-whatsapp-session-details Retrieves details for a specific WhatsApp session. This endpoint requires an access token to be included in the Authorization header. ```APIDOC ## GET /api/whatsapp-sessions/{whatsappSession} ### Description Retrieves details for a specific WhatsApp session. This endpoint requires an access token to be included in the Authorization header. ### Method GET ### Endpoint /api/whatsapp-sessions/{whatsappSession} ### Parameters #### Path Parameters - **whatsappSession** (integer) - Required - ID of the WhatsApp session. ### Request Example curl "https://www.wasenderapi.com/api/whatsapp-sessions/{whatsappSession}" -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the session details including id, name, phone_number, status, account_protection, log_messages, webhook_url, webhook_enabled, webhook_events, api_key, webhook_secret, created_at, and updated_at. #### Response Example { "success": true, "data": { "id": 1, "name": "Business WhatsApp", "phone_number": "+1234567890", "status": "connected", "account_protection": true, "log_messages": true, "webhook_url": "https://example.com/webhook", "webhook_enabled": true, "webhook_events": [ "message", "group_update" ], "api_key": "75075a7bf6417bff59e76fb7205382c2dc74cf1769e76f382c2dc74cf176c0bf", "webhook_secret": "fb61be92ddb7935e0cedcec58e470f6c", "created_at": "2025-04-01T12:00:00Z", "updated_at": "2025-05-08T15:30:00Z" } } ``` -------------------------------- ### Retrieve Session Logs via cURL Source: https://wasenderapi.com/api-docs/sessions/get-session-logs Fetches session logs using a GET request with pagination parameters and API key authentication. ```bash curl -X GET "https://www.wasenderapi.com/api/whatsapp-sessions/my-session-123/session-logs?page=1&per_page=15" -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### JSON Base64 Upload Example Source: https://wasenderapi.com/api-docs/messages/upload-media-file Use this method to upload a Base64-encoded file within a JSON object. The API supports providing the Data URL scheme directly in the base64 string or using a separate mimetype field. ```json { "base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA..." } ``` ```json { "mimetype": "image/png", "base64": "iVBORw0KGgoAAAANSUhEUgA..." } ``` -------------------------------- ### GET /api/whatsapp-sessions/{whatsappSession}/session-logs Source: https://wasenderapi.com/api-docs/sessions/get-session-logs Retrieves a paginated list of session activity logs for a specified WhatsApp session. Useful for debugging and auditing. ```APIDOC ## GET /api/whatsapp-sessions/{whatsappSession}/session-logs ### Description Retrieves a paginated list of session activity logs for the specified WhatsApp session. These logs are crucial for debugging connection issues, tracking the session's lifecycle, and general auditing. ### Method GET ### Endpoint `/api/whatsapp-sessions/{whatsappSession}/session-logs` ### Parameters #### Path Parameters - **whatsappSession** (integer) - Required - The unique identifier of the WhatsApp session. #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. Defaults to 1. - **per_page** (integer) - Optional - The number of items to retrieve per page. Defaults to 10. ### Request Example ```curl curl -X GET "https://www.wasenderapi.com/api/whatsapp-sessions/my-session-123/session-logs?page=1&per_page=15" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the paginated log data. - **current_page** (integer) - The current page number. - **data** (array) - An array of log entries. - **id** (integer) - The unique identifier of the log entry. - **whatsapp_session_id** (integer) - The ID of the associated WhatsApp session. - **event_type** (string) - The type of event that occurred (e.g., "session_restarted"). - **status** (string) - The status of the session at the time of the event (e.g., "connected", "need_scan"). - **occurred_at** (string) - The timestamp when the event occurred in ISO 8601 format. - **first_page_url** (string) - URL for the first page of results. - **from** (integer) - The starting item number for the current page. - **last_page** (integer) - The total number of pages. - **last_page_url** (string) - URL for the last page of results. - **next_page_url** (string) - URL for the next page of results. - **path** (string) - The base path for the API endpoint. - **per_page** (integer) - The number of items per page. - **prev_page_url** (string) - URL for the previous page of results. - **to** (integer) - The ending item number for the current page. - **total** (integer) - The total number of items across all pages. #### Response Example ```json { "success": true, "data": { "current_page": 1, "data": [ { "id": 201, "whatsapp_session_id": 1, "event_type": "session_restarted", "status":"connected", "occurred_at": "2025-09-23T12:00:00.000000Z" }, { "id": 200, "whatsapp_session_id": 1, "event_type": "status_change", "status": "need_scan", "occurred_at": "2025-09-23T11:59:30.000000Z" } ], "first_page_url": "/api/whatsapp-sessions/my-session-123/session-logs?page=1", "from": 1, "last_page": 3, "last_page_url": "/api/whatsapp-sessions/my-session-123/session-logs?page=3", "next_page_url": "/api/whatsapp-sessions/my-session-123/session-logs?page=2", "path": "/api/whatsapp-sessions/my-session-123/session-logs", "per_page": 2, "prev_page_url": null, "to": 2, "total": 6 } } ``` ``` -------------------------------- ### Get Group Invite Link (cURL) Source: https://wasenderapi.com/api-docs/groups/get-group-invite-link Use this cURL command to retrieve the invite link for a specific WhatsApp group. Replace `{groupJid}` with the actual group JID and `YOUR_API_KEY` with your authentication token. ```bash curl "https://www.wasenderapi.com/api/groups/{groupJid}/invite-link" -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### GET /api/groups/invite/{inviteCode} Source: https://wasenderapi.com/api-docs/groups/get-group-invite-info Retrieves metadata for a WhatsApp group from its invite code, allowing users to preview group details like subject, description, and size. ```APIDOC ## GET /api/groups/invite/{inviteCode} ### Description Retrieves metadata for a group from its invite code. This endpoint allows you to fetch public information and metadata about a WhatsApp group by using its invitation code, without actually joining the group. ### Method GET ### Endpoint /api/groups/invite/{inviteCode} ### Parameters #### Path Parameters - **inviteCode** (string) - Required - The unique invitation code from the group invite link. ### Request Example curl -X GET "https://www.wasenderapi.com/api/groups/invite/SAMPLE_INVITE_CODE" -H "Authorization: Bearer YOUR_API_KEY" ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains group metadata including id, subject, owner, creation timestamp, size, description, and participant list. #### Response Example { "success": true, "data": { "id": "123456789-987654321@g.us", "subject": "Official Project Group", "owner": "1234567890@s.whatsapp.net", "creation": 1672531200, "size": 42, "desc": "This is the official group for project updates.", "participants": [ { "id": "111111111@s.whatsapp.net", "admin": "superadmin" }, { "id": "222222222@s.whatsapp.net", "admin": "admin" } ] } } ``` -------------------------------- ### Success Response for Get Phone Number from LID Source: https://wasenderapi.com/api-docs/contacts/get-phone-number-from-lid This is an example of a successful response when retrieving a phone number using a LID. The 'pn' field contains the full phone number JID. ```json { "success": true, "data": { "pn": "1234567890@s.whatsapp.net" } } ``` -------------------------------- ### GET /api/whatsapp-sessions/{whatsappSession}/message-logs Source: https://wasenderapi.com/api-docs/sessions/get-message-logs Retrieves a paginated list of message logs for a specific WhatsApp session. Message logging must be enabled for the session. The response includes pagination details and a list of message log objects. ```APIDOC ## GET /api/whatsapp-sessions/{whatsappSession}/message-logs ### Description Retrieves a paginated list of message logs for a specific session. This endpoint fetches a paginated history of messages sent using our API by the specified WhatsApp session. It is useful for auditing, analytics, or displaying message history in an application. Message logging must be enabled for each session individually in your settings. If logging is disabled, the `content` and the `to` field will be `null`. ### Method GET ### Endpoint `/api/whatsapp-sessions/{whatsappSession}/message-logs` ### Parameters #### Path Parameters - **whatsappSession** (string) - Required - The unique identifier of the WhatsApp session. #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. Defaults to 1. - **per_page** (integer) - Optional - The number of items to retrieve per page. Defaults to 10. ### Request Example ```curl curl -X GET "https://www.wasenderapi.com/api/whatsapp-sessions/my-session-123/message-logs?page=1&per_page=20" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the pagination details and message logs. - **current_page** (integer) - The current page number. - **data** (array) - An array of message log objects. - **id** (string) - The unique identifier of the message log. - **whatsapp_session_id** (string) - The ID of the associated WhatsApp session. - **to** (string) - The recipient's phone number (null if logging is disabled). - **content** (string) - The message content (null if logging is disabled). - **status** (string) - The status of the message (e.g., 'sent', 'in_progress', 'failed'). - **failed_reason** (string) - The reason for failure, if applicable. - **created_at** (string) - The timestamp when the message was created. - **updated_at** (string) - The timestamp when the message was last updated. - **first_page_url** (string) - URL for the first page of results. - **from** (integer) - The starting item number of the current page. - **last_page** (integer) - The total number of pages. - **last_page_url** (string) - URL for the last page of results. - **next_page_url** (string) - URL for the next page of results. - **path** (string) - The base path for the API endpoint. - **per_page** (integer) - The number of items per page. - **prev_page_url** (string) - URL for the previous page of results. - **to** (integer) - The ending item number of the current page. - **total** (integer) - The total number of items across all pages. #### Response Example ```json { "success": true, "data": { "current_page": 1, "data": [ { "id": "1001", "whatsapp_session_id": "501", "to": "+155501001234", "content": "{\"text\":\"This is a sample message. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"}", "status": "sent", "failed_reason": null, "created_at": "2023-10-27 10:30:15", "updated_at": "2023-10-27 10:30:17" }, { "id": "1002", "whatsapp_session_id": "502", "to": "+4455501005678", "content": "{\"text\":\"Hello! This is an example message sent to a user. How can we help you today?\"}", "status": "in_progress", "failed_reason": null, "created_at": "2023-10-27 10:32:45", "updated_at": "2023-10-27 10:32:48" }, { "id": "1003", "whatsapp_session_id": "503", "to": "+5255501009876", "content": "{\"text\":\"Just a test message to verify the connection.\"}", "status": "failed", "failed_reason": "invalid WhatsApp number", "created_at": "2023-10-27 10:35:01", "updated_at": "2023-10-27 10:35:03" } ], "first_page_url": "/api/session-id-123/message-logs?page=1", "from": 1, "last_page": 5, "last_page_url": "/api/session-id-123/message-logs?page=5", "next_page_url": "/api/session-id-123/message-logs?page=2", "path": "/api/session-id-123/message-logs", "per_page": 3, "prev_page_url": null, "to": 3, "total": 15 } } ``` ``` -------------------------------- ### Create WhatsApp Session Request Source: https://wasenderapi.com/api-docs/sessions/create-whatsapp-session Use this cURL command to initiate a new session. Ensure the Authorization header contains a valid personal access token. ```bash curl -X POST "https://www.wasenderapi.com/api/whatsapp-sessions" -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{ "name": "Sample Name", "phone_number": "Sample Phone_number", "account_protection": true, "log_messages": true, "read_incoming_messages": false, "webhook_url": "Sample Webhook_url", "webhook_enabled": true, "webhook_events": [ "messages.received", "session.status", "messages.update" ] }' ``` -------------------------------- ### POST /api/whatsapp-sessions/{whatsappSession}/connect Source: https://wasenderapi.com/api-docs/sessions/connect-whatsapp-session Initiates the connection process for a WhatsApp session. Requires an active subscription and an access token in the Authorization header. ```APIDOC ## POST /api/whatsapp-sessions/{whatsappSession}/connect ### Description Initiates the connection process for a WhatsApp session. Requires an active subscription. ### Method POST ### Endpoint /api/whatsapp-sessions/{whatsappSession}/connect ### Parameters #### Path Parameters - **whatsappSession** (integer) - Required - ID of the WhatsApp session. #### Request Body This endpoint does not require a request body. ### Request Example ```curl curl -X POST "https://www.wasenderapi.com/api/whatsapp-sessions/{whatsappSession}/connect" \ -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains session connection details. - **status** (string) - The current status of the WhatsApp session (e.g., "NEED_SCAN", "INITIALIZED"). - **qrCode** (string) - The QR code string needed for scanning. This expires after 45 seconds. Use the GetQrCode endpoint to generate a fresh one. #### Response Example ```json { "success": true, "data": { "status": "NEED_SCAN", "qrCode": "2@DTMUHeYfa9/RMXr8A2IP3/..." } } ``` ``` -------------------------------- ### Get Session User Info Source: https://wasenderapi.com/api-docs/sessions/get-session-user-info Retrieves information about the WhatsApp user associated with the current API key session. Use this endpoint to get details about the active WhatsApp account linked to your API key. ```bash curl "https://www.wasenderapi.com/api/user" -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### GET /api/contacts/{contactPhoneNumber} Source: https://wasenderapi.com/api-docs Retrieves detailed information for a specific contact. ```APIDOC ## GET /api/contacts/{contactPhoneNumber} ### Description Retrieves detailed information for a specific contact. ### Method GET ### Endpoint /api/contacts/{contactPhoneNumber} ### Parameters #### Path Parameters - **contactPhoneNumber** (string) - Required - The phone number of the contact. ``` -------------------------------- ### GET /api/groups/invite/{inviteCode} Source: https://wasenderapi.com/api-docs/groups Retrieves metadata for a group from its invite code. ```APIDOC ## GET /api/groups/invite/{inviteCode} ### Description Retrieves metadata for a group from its invite code. ### Method GET ### Endpoint /api/groups/invite/{inviteCode} ### Parameters #### Path Parameters - **inviteCode** (string) - Required - The invite code of the group. ``` -------------------------------- ### Connect WhatsApp Session via cURL Source: https://wasenderapi.com/api-docs/sessions/connect-whatsapp-session Use this cURL command to initiate a connection for a WhatsApp session. Ensure the Authorization header includes your personal access token. ```bash curl -X POST "https://www.wasenderapi.com/api/whatsapp-sessions/{whatsappSession}/connect" -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" -H "Content-Type: application/json" ``` -------------------------------- ### GET /api/groups/{groupJid}/participants Source: https://wasenderapi.com/api-docs/groups Retrieves a list of participants for a specific group. ```APIDOC ## GET /api/groups/{groupJid}/participants ### Description Retrieves a list of participants for a specific group. ### Method GET ### Endpoint /api/groups/{groupJid}/participants ### Parameters #### Path Parameters - **groupJid** (string) - Required - The JID of the group. ``` -------------------------------- ### GET /api/groups Source: https://wasenderapi.com/api-docs/groups Retrieves a list of all WhatsApp groups the connected account is a member of. ```APIDOC ## GET /api/groups ### Description Retrieves a list of all WhatsApp groups the connected account is a member of. ### Method GET ### Endpoint /api/groups ``` -------------------------------- ### POST /api/whatsapp-sessions Source: https://wasenderapi.com/api-docs/sessions Creates a new WhatsApp session with the provided details. ```APIDOC ## POST /api/whatsapp-sessions ### Description Creates a new WhatsApp session with the provided details. Requires an active subscription and is subject to session limits. ### Method POST ### Endpoint /api/whatsapp-sessions ``` -------------------------------- ### Contacts API Response Structure Source: https://wasenderapi.com/api-docs/contacts/get-all-contacts Example JSON response structure for the contacts endpoint. ```json { "success": true, "data": [ { "jid": "1234567890", "name": "Contact Name", "notify": "Contact Display Name", "verifiedName": "Verified Business Name", "imgUrl": "https:\/\/profile.pic.url\/image.jpg", "status": "Hey there! I am using WhatsApp." } ] } ``` -------------------------------- ### Configure WasenderAPI MCP settings Source: https://wasenderapi.com/api-docs/getting-started/model-context-protocol-mcp-integration Use this JSON configuration to set up the WasenderAPI as a remote MCP server with authentication. ```json { "mcp": { "WasenderAPI": { "type": "remote", "url": "https://wasenderapi.com/mcp", "enabled": true, "headers": { "Authorization": "Bearer YOUR_PERSONAL_ACCESS_TOKEN" } } } } ``` -------------------------------- ### GET /api/groups/{groupJid}/picture Source: https://wasenderapi.com/api-docs/groups/get-group-profile-picture Retrieves the URL of the profile picture for a specific group. ```APIDOC ## GET /api/groups/{groupJid}/picture ### Description Retrieves the URL of the profile picture for a specific group. ### Method GET ### Endpoint `/api/groups/{groupJid}/picture` ### Parameters #### Path Parameters - **groupJid** (string) - Required - The JID (Jabber ID) of the group in the format 123456789-987654321@g.us. ### Request Example ```curl curl "https://www.wasenderapi.com/api/groups/{groupJid}/picture" -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the profile picture URL. - **imgUrl** (string) - The URL of the group's profile picture. #### Response Example ```json { "success": true, "data": { "imgUrl": "https:\/\/profile.pic.url\/image.jpg" } } ``` ``` -------------------------------- ### GET /api/contacts/{contactPhoneNumber}/picture Source: https://wasenderapi.com/api-docs/contacts/get-contact-profile-picture Retrieves the URL of the profile picture for a specific contact. ```APIDOC ## GET /api/contacts/{contactPhoneNumber}/picture ### Description Retrieves the URL of the profile picture for a specific contact. ### Method GET ### Endpoint /api/contacts/{contactPhoneNumber}/picture ### Parameters #### Path Parameters - **contactPhoneNumber** (string) - Required - The JID (Jabber ID) of the contact in E.164 format (international phone number) e.g., 1234567890. ### Request Example ```bash curl "https://www.wasenderapi.com/api/contacts/{contactPhoneNumber}/picture" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the profile picture URL. - **imgUrl** (string) - The URL of the contact's profile picture. #### Response Example ```json { "success": true, "data": { "imgUrl": "https:\/\/profile.pic.url\/image.jpg" } } ``` ``` -------------------------------- ### POST /api/whatsapp-sessions Source: https://wasenderapi.com/api-docs/sessions/create-whatsapp-session Creates a new WhatsApp session with the provided details. Requires an active subscription and an access token in the Authorization header. ```APIDOC ## POST /api/whatsapp-sessions ### Description Creates a new WhatsApp session with the provided details. Requires an active subscription and is subject to session limits. This endpoint requires an access token to be included in the Authorization header. ### Method POST ### Endpoint /api/whatsapp-sessions ### Parameters #### Request Body - **name** (string) - Required - Name of the WhatsApp session. - **phone_number** (string) - Required - Phone number in international format. - **account_protection** (boolean) - Required - Enable account protection features. - **log_messages** (boolean) - Required - Enable message logging. - **webhook_url** (string) - Optional - URL for receiving webhook notifications. - **webhook_enabled** (boolean) - Optional - Enable webhook notifications. - **webhook_events** (array) - Optional - Array of events to receive webhook notifications for. - **read_incoming_messages** (boolean) - Optional - Enable the option to automatically mark messages as read when they are received. - **auto_reject_calls** (boolean) - Optional - Enable automatic rejection of incoming calls. - **ignore_groups** (boolean) - Optional - ignore all webhook events from groups. - **ignore_channels** (boolean) - Optional - ignore all webhook events from channels (newsletters). - **ignore_broadcasts** (boolean) - Optional - ignore all webhook events from broadcast lists. - **proxy_url** (string) - Optional - Allowed protocols: http, https, socks5. Use a public domain only. - **always_online** (boolean) - Optional - When enabled, your session will always appear online to your contacts. ### Request Example { "name": "Sample Name", "phone_number": "Sample Phone_number", "account_protection": true, "log_messages": true, "read_incoming_messages": false, "webhook_url": "Sample Webhook_url", "webhook_enabled": true, "webhook_events": [ "messages.received", "session.status", "messages.update" ] } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - The created session object containing id, name, phone_number, status, and configuration details. #### Response Example { "success": true, "data": { "id": 1, "name": "Business WhatsApp", "phone_number": "+1234567890", "status": "connected", "account_protection": true, "log_messages": true, "read_incoming_messages": false, "webhook_url": "https://example.com/webhook", "webhook_enabled": true, "webhook_events": [ "messages.received", "session.status", "messages.update" ], "api_key": "75075a7bf6417bff59e76fb7205382c2dc74cf1769e76f382c2dc74cf176c0bf", "webhook_secret": "fb61be92ddb7935e0cedcec58e470f6c", "created_at": "2025-04-01T12:00:00Z", "updated_at": "2025-05-08T15:30:00Z" } } ``` -------------------------------- ### Retrieve all groups via cURL Source: https://wasenderapi.com/api-docs/groups/get-all-groups Use this command to fetch the list of groups. Ensure the Authorization header is set with your valid API key. ```bash curl "https://www.wasenderapi.com/api/groups" -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Create New WhatsApp Group Source: https://wasenderapi.com/api-docs/groups/create-a-new-group Use this endpoint to create a new WhatsApp group. Provide the desired group name and an array of participant JIDs. Ensure your API key is included in the Authorization header. ```bash curl -X POST "https://www.wasenderapi.com/api/groups" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "My New Group", "participants": ["1234567890@s.whatsapp.net", "0987654321@s.whatsapp.net"]}' ``` -------------------------------- ### Get Group Invite Link Source: https://wasenderapi.com/api-docs This endpoint retrieves the invite link for a specific WhatsApp group. ```APIDOC ## Get Group Invite Link ### Description This endpoint retrieves the invite link for a specific WhatsApp group. ### Method GET ### Endpoint `/api/groups/{groupJid}/invite-link` ``` -------------------------------- ### GET /api/user Source: https://wasenderapi.com/api-docs/sessions Retrieves information about the WhatsApp user associated with the current API key session. ```APIDOC ## GET /api/user ### Description Retrieves information about the WhatsApp user associated with the current API key session. ### Method GET ### Endpoint /api/user ``` -------------------------------- ### GET /api/whatsapp-sessions/{whatsappSession}/qrcode Source: https://wasenderapi.com/api-docs/sessions/get-whatsapp-session-qr-code Retrieves the QR code needed to connect a WhatsApp session with the WhatsApp client. Requires an active subscription. Before calling this endpoint, you must first initialize the WhatsApp session by calling the Connect WhatsApp Session endpoint. This endpoint requires an access token to be included in the Authorization header. ```APIDOC ## GET /api/whatsapp-sessions/{whatsappSession}/qrcode ### Description Retrieves the QR code needed to connect a WhatsApp session with the WhatsApp client. Requires an active subscription. ### Method GET ### Endpoint `/api/whatsapp-sessions/{whatsappSession}/qrcode` ### Parameters #### Path Parameters - **whatsappSession** (integer) - Required - ID of the WhatsApp session. ### Request Example ```bash curl "https://www.wasenderapi.com/api/whatsapp-sessions/{whatsappSession}/qrcode" \ -H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the QR code data. - **qrCode** (string) - The QR code string. Use a QR code library to generate an image. #### Response Example ```json { "success": true, "data": { "qrCode": "2@DfzdTHeYfa9/RMXr8A2IP3/...." } } ``` ``` -------------------------------- ### Restart WhatsApp Session Source: https://wasenderapi.com/api-docs/sessions/restart-whatsapp-session Use this endpoint to initiate a soft restart of a connected WhatsApp session. The session must be in a 'connected' state. Replace 'my-session-123' with your actual session ID and 'YOUR_API_KEY' with your valid API key. ```bash curl -X POST "https://www.wasenderapi.com/api/whatsapp-sessions/my-session-123/restart" -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### GET /api/contacts Source: https://wasenderapi.com/api-docs/contacts/get-all-contacts Retrieves a list of all contacts synced with the WhatsApp session, with optional support for pagination. ```APIDOC ## GET /api/contacts ### Description Retrieves a list of all contacts synced with the WhatsApp session. ### Method GET ### Endpoint /api/contacts ### Parameters #### Query Parameters - **paginated** (boolean) - Optional - When true, returns a paginated response with data.items and data.pagination. Default: false. - **page** (integer) - Optional - Page number (only used when paginated=true). Default: 1. - **limit** (integer) - Optional - Items per page (only used when paginated=true). Default: 20. ### Request Example curl "https://www.wasenderapi.com/api/contacts?paginated=true&page=1&limit=20" -H "Authorization: Bearer YOUR_API_KEY" ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array/object) - The list of contacts or paginated data object. #### Response Example { "success": true, "data": [ { "jid": "1234567890", "name": "Contact Name", "notify": "Contact Display Name", "verifiedName": "Verified Business Name", "imgUrl": "https://profile.pic.url/image.jpg", "status": "Hey there! I am using WhatsApp." } ] } ``` -------------------------------- ### Register WasenderAPI MCP in Claude CLI Source: https://wasenderapi.com/api-docs/getting-started/model-context-protocol-mcp-integration Use this command to register the WasenderAPI MCP server with the Claude CLI. Requires a valid Personal Access Token. ```bash claude mcp add --transport http wasenderapi https://wasenderapi.com/mcp \ --header "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" ```