{"id":21942913,"url":"https://github.com/green-api/whatsapp-api-client-cpp","last_synced_at":"2025-10-09T23:30:41.593Z","repository":{"id":247211334,"uuid":"819453351","full_name":"green-api/whatsapp-api-client-cpp","owner":"green-api","description":"Library GREEN API for sending messages to WhatsApp in C++","archived":false,"fork":false,"pushed_at":"2024-12-08T03:06:37.000Z","size":129,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-12-08T04:17:11.393Z","etag":null,"topics":["whatsapp","whatsapp-api","whatsapp-bot","whatsapp-chat","whatsapp-chatbot","whatsapp-chatbot-cpp","whatsapp-cpp"],"latest_commit_sha":null,"homepage":"https://green-api.com/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/green-api.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-24T14:31:52.000Z","updated_at":"2024-12-08T03:04:34.000Z","dependencies_parsed_at":"2024-07-11T19:02:20.916Z","dependency_job_id":null,"html_url":"https://github.com/green-api/whatsapp-api-client-cpp","commit_stats":null,"previous_names":["green-api/whatsapp-api-client-cpp"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-client-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-client-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-client-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-client-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/green-api","download_url":"https://codeload.github.com/green-api/whatsapp-api-client-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235879936,"owners_count":19059722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["whatsapp","whatsapp-api","whatsapp-bot","whatsapp-chat","whatsapp-chatbot","whatsapp-chatbot-cpp","whatsapp-cpp"],"created_at":"2024-11-29T03:27:14.209Z","updated_at":"2025-10-09T23:30:36.262Z","avatar_url":"https://github.com/green-api.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# whatsapp-api-client-cpp\n\n![](https://img.shields.io/badge/license-CC%20BY--ND%204.0-green)\n\n## Support links\n\n[![Support](https://img.shields.io/badge/support@green--api.com-D14836?style=for-the-badge\u0026logo=gmail\u0026logoColor=white)](mailto:support@green-api.com)\n[![Support](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge\u0026logo=telegram\u0026logoColor=white)](https://t.me/greenapi_support_ru_bot)\n[![Support](https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge\u0026logo=whatsapp\u0026logoColor=white)](https://wa.me/447458038017)\n\n## Guides \u0026 News\n\n[![Guides](https://img.shields.io/badge/YouTube-%23FF0000.svg?style=for-the-badge\u0026logo=YouTube\u0026logoColor=white)](https://www.youtube.com/@greenapi-en)\n[![News](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge\u0026logo=telegram\u0026logoColor=white)](https://t.me/green_api)\n[![News](https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge\u0026logo=whatsapp\u0026logoColor=white)](https://whatsapp.com/channel/0029VaLj6J4LNSa2B5Jx6s3h)\n\n- [Документация на русском языке](https://github.com/green-api/whatsapp-api-client-cpp/blob/master/README.ru.md).\n\n`whatsapp-api-client-cpp` - library for integration with WhatsApp messenger using the API service [green-api.com](https://green-api.com/). \nYou should get a registration token and an account ID in your [personal cabinet](https://console.green-api.com/). \nThere is a free developer account tariff.\n\n- [whatsapp-api-client-cpp](#whatsapp-api-client-cpp)\n  - [Support links](#support-links)\n  - [Guides \\\u0026 News](#guides--news)\n  - [API](#api)\n  - [Authorization](#authorization)\n  - [Installation](#installation)\n    - [Windows](#windows)\n      - [Windows x64](#windows-x64)\n  - [Building the library](#building-the-library)\n    - [Windows](#windows-1)\n    - [Importing the library](#importing-the-library)\n    - [Linux](#linux)\n  - [Examples](#examples)\n    - [How to initialize an object](#how-to-initialize-an-object)\n    - [Sending a text message example](#sending-a-text-message-example)\n    - [Working with library examples](#working-with-library-examples)\n  - [Examples list](#examples-list)\n  - [Full list of all methods](#full-list-of-all-methods)\n  - [Service methods documentation](#service-methods-documentation)\n  - [Library dependencies](#library-dependencies)\n  - [Licence](#licence)\n\n## API\n\nThe documentation for the REST API can be found at the [link](https://green-api.com/en/docs/api/). The library is a wrapper for the REST API, so the documentation at the link above also applies.\n\n## Authorization\n\nTo send a message or perform other GREEN API methods, the WhatsApp account in the phone app must be authorized. To authorize the account, go to your [cabinet](https://console.green-api.com/) and scan the QR code using the WhatsApp app.\n\n## Installation\n\nThis library uses C++ 17, supports Linux (GCC) and Windows (Visual Studio 2019/2022) compilers.\n\nClone library repository\n\n```bash\ngit clone https://github.com/green-api/whatsapp-api-client-cpp.git\n```\n\n### Windows\n\nInstalling dependencies using `vcpkg` package manager:\n\n```bash\ngit clone https://github.com/Microsoft/vcpkg.git\ncd vcpkg\nbootstrap-vcpkg.bat\nvcpkg install curl\nvcpkg install nlohmann-json\n# vcpkg install websocketpp (optional)\nvcpkg integrate install\n```\n\n#### Windows x64\n\nMost Windows machines now have x64 version, but `vcpkg` uses x86 packages by default.\n\n```bash\nvcpkg install nlohmann-json:x64-windows\nvcpkg install curl:x64-windows\n```\n\n\u003e To execute commands in PowerShell it is required to change commands to .\\\\vcpkg\n\nAfter building `bootstrap-vcpkg.bat` it is required to **add `vcpkg.exe` into the PATH variables of your system** `PATH\\vcpkg\\installed\\x64-windows\\bin`.\n\n## Building the library\n\n### Windows\n\nTo build the library you need:\n\n- [CMake](https://cmake.org/download/) - a cross-platform utility for automatically building software from source code.\n- Compiler [Microsoft Visual C++ (MSVC)](https://visualstudio.microsoft.com/ru/downloads/) for C++ applications.\n\nBuilding the library using CMake and Visual Studio compiler\n\nBuilding is done by using the **build.bat** scenario or manually by using CMake (compiling Debug version of the library):\n\n\n```bash\nmkdir build\ncd build\ncmake ..\ncd ../\ncmake --build build\n```\n\n\u003e Most likely you will have to specify direct paths to the used libraries, uncomment the lines in [CMakeList.txt](./CMakeLists.txt)\n\n### Importing the library\n\nYou can import the library in Visual Studio \nby adding the `whatsapp-api-client-cpp.lib` file in the project dependencies:\n\n1. Properties-\u003eConfiguration properties-\u003eC/C++-\u003eGeneral-\u003eAdditional Include Directories (PATH/whatsapp-api-client-cpp/include)\n2. Properties-\u003eConfiguration properties-\u003eLinker-\u003eGeneral-\u003eAdditional Library Directories (PATH/build/)\n3. Properties-\u003eConfiguration properties-\u003eLinker-\u003eInpit-\u003eAdditional Dependencies (whatsapp-api-client-cpp.lib)\n\n\u003e Carefully choose your configuration type and install required library version (debug and release)\n\n### Linux\n\nInstalling dependencies with `vcpkg` package manager:\n\n- Dependencies\n  - curl\n  - nlohmann-json\n  - websocketpp (optional)\n\nYou can install dependencies with ready-made **install.sh** scenario (`sudo sh install.sh`) or manually:\n\n```bash\ngit clone https://github.com/Microsoft/vcpkg.git\ncd vcpkg\n./bootstrap-vcpkg.sh\n./vcpkg/vcpkg install curl\n./vcpkg/vcpkg install nlohmann-json\n# ./vcpkg install websocketpp (optional)\n./vcpkg/vcpkg integrate install\n```\n\nYou can build the library with ready-made **build.sh** scenario (`sudo sh build.sh`) or manually:\n\n```bash\nmkdir build\ncmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake\ncmake --build build/\n\n```\n\n\u003e You can change vcpkg catalogue by specifying relative or absolute path.\n\nYou might need to install additional packages to build the library:\n\n```sh\nsudo apt-get update\nsudo apt-get install cmake\nsudo apt-get install g++\nsudo apt-get install pkg-config\nsudo apt-get install libcurl4-openssl-dev\nsudo apt install build-essential\n```\n\n## Examples\n\n### How to initialize an object\n\nTo initialize an object it is required to use apiUrl and mediaUrl parameters specifically for your instance from your [personal cabinet](https://console.green-api.com/), that way you will get the most stable API work and minimal response time.\n\n```cpp\ngreenapi::GreenApi instance1101000001{\n    \"https://api.green-api.com\",\n    \"https://media.green-api.com\",\n    \"1101123456\",\n    \"87be9e9532fc49748f2a44b9242e55f2e89f4bf97ed6498f80\"\n    };\n```\n\n### Sending a text message example\nLink to the example: [main.cpp](./main.cpp).\n\n```cpp\nnlohmann::json sendMessageJson{\n\t\t{ \"chatId\",\"71234567890@c.us\" },\n\t\t{ \"message\",\"I use GREEN-API to send this message to you!\" }\n\t};\n\tgreenapi::Response sendMessage = instance1101000001.sending.sendMessage(sendMessageJson);\n\n\tif (sendMessage.error) {\n\t\tstd::cout \u003c\u003c \"sendMessage error: {status code: \" \u003c\u003c sendMessage.status_code \u003c\u003c \", request time: \" \u003c\u003c sendMessage.total_time \u003c\u003c \", body: \" \u003c\u003c sendMessage.bodyStr \u003c\u003c \"}\" \u003c\u003c \"\\n\" \u003c\u003c std::endl;\n\t}\n\telse {\n\t\tstd::cout \u003c\u003c \"\\tidMessage: \" \u003c\u003c sendMessage.bodyJson[\"idMessage\"] \u003c\u003c \"\\n\" \u003c\u003c std::endl;\n\t}\n```\n\n### Working with library examples\n\nAll examples are put in the examples folder, every file has examples of all the methods with all the supported parameters\nTo run a particular example it is required to copy a code section into your main.cpp file and use your values in the parameters.\n\n## Examples list\n\n| Description                                 | Module                                                        |\n| ------------------------------------------- | ------------------------------------------------------------- |\n| Sending a text example                      | [main.cpp](./main.cpp)                                        |\n| Examples of account methods                 | [test_accaunt.cpp](./examples/test_accaunt.cpp)               |\n| Examples of sending methods                 | [test_sending.cpp](./examples/test_sending.cpp)               |\n| Examples of receiving methods               | [test_receiving.cpp](./examples/test_receiving.cpp)           |\n| Examples of journal methods                 | [test_journals.cpp](./examples/test_journals.cpp)             |\n| Examples of queue methods                   | [test_queues.cpp](./examples/test_queues.cpp)                 |\n| Examples of group methods                   | [test_groups.cpp](./examples/test_groups.cpp)                 |\n| Examples of status methods                  | [test_statuses.cpp](./examples/test_statuses.cpp)             |\n| Examples of read mark methods               | [test_readMark.cpp](./examples/test_readMark.cpp)             |\n| Examples of service methods                 | [test_serviceMethods.cpp](./examples/test_serviceMethods.cpp) |\n\n## Full list of all methods\n\n| API Method              | Description                  | Documentation link                       |\n| ---------------------- | ------------------------- | ---------------------------------------- |\n| `account.getSettings`                | Method for getting current settings of the account                                                                | [GetSettings](https://green-api.com/en/docs/api/account/GetSettings/)                                       |\n| `account.getWaSettings`              | Method for getting information of the WhatsApp account                                                           | [GetWaSettings](https://green-api.com/en/docs/api/account/GetWaSettings/)                                   |\n| `account.setSettings`                | Method to set account                                                                        | [SetSettings](https://green-api.com/en/docs/api/account/SetSettings/)                                       |\n| `account.getStateInstance`           | Method for getting the account state                                                                       | [GetStateInstance](https://green-api.com/en/docs/api/account/GetStateInstance/)                             |\n| `account.getStatusInstance`          | Method for getting socket connection state of the account with WhatsApp                                 | [GetStatusInstance](https://green-api.com/en/docs/api/account/GetStatusInstance/)                           |\n| `account.reboot`                     | Method for restarting the account                                                                               | [Reboot](https://green-api.com/en/docs/api/account/Reboot/)                                                 |\n| `account.logout`                     | Method for logging out                                                                            | [Logout](https://green-api.com/en/docs/api/account/Logout/)                                                 |\n| `account.qr`                         | Method for getting a QR code                                                                                  | [QR](https://green-api.com/en/docs/api/account/QR/)                                                         |\n| `account.setProfilePicture`          | Method for setting a profile picture                                                                         | [SetProfilePicture](https://green-api.com/en/docs/api/account/SetProfilePicture/)                           |\n| `account.getAuthorizationCode`       | Method for authorizing by phone number                                                       | [GetAuthorizationCode](https://green-api.com/en/docs/api/account/GetAuthorizationCode/)                     |\n| `device.getDeviceInfo`               | Method for getting information about the device (phone) on which the WhatsApp Business application is running    | [GetDeviceInfo](https://green-api.com/en/docs/api/phone/GetDeviceInfo/)                                     |\n| `groups.createGroup`                 | Method for creating a group chat                                                                           | [CreateGroup](https://green-api.com/en/docs/api/groups/CreateGroup/)                                        |\n| `groups.updateGroupName`             | Method for changing a group chat name                                                                               | [UpdateGroupName](https://green-api.com/en/docs/api/groups/UpdateGroupName/)                                |\n| `groups.getGroupData`                | Method for getting a group chat data                                                                                     | [GetGroupData](https://green-api.com/en/docs/api/groups/GetGroupData/)                                      |\n| `groups.addGroupParticipant`         | Method for adding a participant into a group chat                                                                                 | [AddGroupParticipant](https://green-api.com/en/docs/api/groups/AddGroupParticipant/)                        |\n| `groups.removeGroupParticipant`      | Method for deleting a participant from a group chat                                                                                | [RemoveGroupParticipant](https://green-api.com/en/docs/api/groups/RemoveGroupParticipant/)                  |\n| `groups.setGroupAdmin`               | Method for setting a participant as a group administrator                                                                 | [SetGroupAdmin](https://green-api.com/en/docs/api/groups/SetGroupAdmin/)                                    |\n| `groups.removeAdmin`                 | Method for removing administrator rights from a participant                                                             | [RemoveAdmin](https://green-api.com/en/docs/api/groups/RemoveAdmin/)                                        |\n| `groups.setGroupPicture`             | Method for setting a group picture                                                                                         | [SetGroupPicture](https://green-api.com/en/docs/api/groups/SetGroupPicture/)                                |\n| `groups.leaveGroup`                  | Method for leaving from a group                                                  | [LeaveGroup](https://green-api.com/en/docs/api/groups/LeaveGroup/)                                          |\n| `journals.getChatHistory`            | Method for getting a chat history                                                                                   | [GetChatHistory](https://green-api.com/en/docs/api/journals/GetChatHistory/)                                |\n| `journals.getMessage`                | Method for getting a message                                                                                            | [GetMessage](https://green-api.com/en/docs/api/journals/GetMessage/)                                        |\n| `journals.lastIncomingMessages`      | Method for getting last incoming messages                                                                      | [LastIncomingMessages](https://green-api.com/en/docs/api/journals/LastIncomingMessages/)                    |\n| `journals.lastOutgoingMessages`      | Method for getting last outgoing messages                                                                  | [LastOutgoingMessages](https://green-api.com/en/docs/api/journals/LastOutgoingMessages/)                    |\n| `queues.showMessagesQueue`           | Method for getting messages that are in the outgoing messages queue                                      | [ShowMessagesQueue](https://green-api.com/en/docs/api/queues/ShowMessagesQueue/)                            |\n| `queues.clearMessagesQueue`          | Method for clearing messages from the outgoing message queue                                                              | [ClearMessagesQueue](https://green-api.com/en/docs/api/queues/ClearMessagesQueue/)                          |\n| `marking.readChat`                   | Method for marking a chat as read                                                              | [ReadChat](https://green-api.com/en/docs/api/marks/ReadChat/)                                               |\n| `receiving.receiveNotification`      | Method for receiving a notification from the incoming notification queue                                      | [ReceiveNotification](https://green-api.com/en/docs/api/receiving/technology-http-api/ReceiveNotification/) |\n| `receiving.deleteNotification`       | Method for deleting a notification from the incoming notification queue                                              | [DeleteNotification](https://green-api.com/en/docs/api/receiving/technology-http-api/DeleteNotification/)   |\n| `receiving.downloadFile`             | Method for downloading file from outgoing or incoming message                                                          | [DownloadFile](https://green-api.com/en/docs/api/receiving/files/DownloadFile/)                             |\n| `sending.sendMessage`                | Method for sending a text message to a personal or group chat                                           | [SendMessage](https://green-api.com/en/docs/api/sending/SendMessage/)                                       |\n| `sending.sendButtons`                | Method for sending buttons to a personal or group chat                                           | [SendButtons](https://green-api.com/en/docs/api/sending/SendButtons/)                                       |\n| `sending.sendTemplateButtons`        | Method for sending a message with interactive buttons from the list of templates in a personal or group chat        | [SendTemplateButtons](https://green-api.com/en/docs/api/sending/SendTemplateButtons/)                       |\n| `sending.sendListMessage`            | Method for sending a message with a selection button from a list of values to a personal or group chat                  | [SendListMessage](https://green-api.com/en/docs/api/sending/SendListMessage/)                               |\n| `sending.sendFileByUpload`           | Method for sending a file through a form (form-data)                                               | [SendFileByUpload](https://green-api.com/en/docs/api/sending/SendFileByUpload/)                             |\n| `sending.sendFileByUrl`              | Method for sending a file by URL                                                             | [SendFileByUrl](https://green-api.com/en/docs/api/sending/SendFileByUrl/)                                   |\n| `sending.uploadFile`                 | Method for uploading a file to the cloud storage, which can be sent using the sendFileByUrl method                 | [UploadFile](https://green-api.com/en/docs/api/sending/UploadFile/)                                         |\n| `sending.sendLocation`               | Method for sending a location                                                                      | [SendLocation](https://green-api.com/en/docs/api/sending/SendLocation/)                                     |\n| `sending.sendContact`                | Method for sending a contact                                                                     | [SendContact](https://green-api.com/en/docs/api/sending/SendContact/)                                       |\n| `sending.sendLink`                   | Method for sending a message with a link that will add an image preview, title and description | [SendLink](https://green-api.com/en/docs/api/sending/SendLink/)                                             |\n| `sending.forwardMessages`            | Method for forwarding messages to a personal or group chat                                                     | [ForwardMessages](https://green-api.com/en/docs/api/sending/ForwardMessages/)                               |\n| `sending.sendPoll`                   | Method for sending messages with a poll to a private or group chat                                            | [SendPoll](https://green-api.com/en/docs/api/sending/SendPoll/)                                             |\n| `serviceMethods.checkWhatsapp`       | Method for checking if there is a WhatsApp account on the phone number                                                              | [CheckWhatsapp](https://green-api.com/en/docs/api/service/CheckWhatsapp/)                                   |\n| `serviceMethods.getAvatar`           | Method for getting the avatar of the correspondent or group chat                                                                | [GetAvatar](https://green-api.com/en/docs/api/service/GetAvatar/)                                           |\n| `serviceMethods.getContacts`         | Method for getting contacts of current account                                                       | [GetContacts](https://green-api.com/en/docs/api/service/GetContacts/)                                       |\n| `serviceMethods.getContactInfo`      | Method for getting information of the contact                                                                    | [GetContactInfo](https://green-api.com/en/docs/api/service/GetContactInfo/)                                 |\n| `serviceMethods.editMessage`         | Method for editing a message in the chat                                                                                           | [EditMessage](https://green-api.com/en/docs/api/service/editMessage/)                                   |\n| `serviceMethods.deleteMessage`       | Method for deleting a message in the chat                                                                                           | [DeleteMessage](https://green-api.com/en/docs/api/service/deleteMessage/)                                   |\n| `serviceMethods.archiveChat`         | Method for archiving a chat                                                                                                      | [ArchiveChat](https://green-api.com/en/docs/api/service/archiveChat/)                                       |\n| `serviceMethods.unarchiveChat`       | Method for unarchiving a chat                                                                                                   | [UnarchiveChat](https://green-api.com/en/docs/api/service/unarchiveChat/)                                   |\n| `serviceMethods.setDisappearingChat` | Method for changing the settings of disappearing messages in chats                                                    | [SetDisappearingChat](https://green-api.com/en/docs/api/service/SetDisappearingChat/)                       |     |\n\n## Service methods documentation\n\n[https://green-api.com/docs/api/](https://green-api.com/en/docs/api/).\n\n## Library dependencies\n\n- [curl](https://vcpkg.io/en/package/curl) - for HTTP requests.\n- [nlohmann-json](https://vcpkg.io/en/package/nlohmann-json) - to work with JSON.\n- [websocketpp](https://vcpkg.io/en/package/websocketpp) - for websocket requests.\n\n## Licence\n\nLicences under [\nCreative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)\n](https://creativecommons.org/licenses/by-nd/4.0/).\n[LICENSE](../LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-api%2Fwhatsapp-api-client-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreen-api%2Fwhatsapp-api-client-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-api%2Fwhatsapp-api-client-cpp/lists"}