{"id":21942921,"url":"https://github.com/green-api/whatsapp-api-webhook-server-java","last_synced_at":"2026-04-11T00:19:36.053Z","repository":{"id":199839994,"uuid":"703432538","full_name":"green-api/whatsapp-api-webhook-server-java","owner":"green-api","description":"Create a Java server endpoint to get WhatsApp messages webhooks","archived":false,"fork":false,"pushed_at":"2024-03-05T20:30:48.000Z","size":133,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-03T16:34:22.326Z","etag":null,"topics":["java","whatsapp","whatsapp-api","whatsapp-bot"],"latest_commit_sha":null,"homepage":"https://green-api.com/en/docs/sdk/java/","language":"Java","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.txt","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":"2023-10-11T08:31:42.000Z","updated_at":"2024-03-31T14:26:58.000Z","dependencies_parsed_at":"2023-11-07T04:15:30.957Z","dependency_job_id":"f8f5bfb0-3259-4b1f-9085-423953a10a6e","html_url":"https://github.com/green-api/whatsapp-api-webhook-server-java","commit_stats":null,"previous_names":["green-api/whatsapp-api-webhook-server-java"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-webhook-server-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-webhook-server-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-webhook-server-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-api-webhook-server-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/green-api","download_url":"https://codeload.github.com/green-api/whatsapp-api-webhook-server-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244981019,"owners_count":20542287,"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":["java","whatsapp","whatsapp-api","whatsapp-bot"],"created_at":"2024-11-29T03:27:17.206Z","updated_at":"2025-12-30T23:46:37.661Z","avatar_url":"https://github.com/green-api.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# whatsapp-api-webhook-server-java\n\n- [Документация на русском языке](src/main/java/com/greenapi/server/docs/README_RU.md).\n\nwhatsapp-api-webhook-server-java is a library for integration with WhatsApp messenger using the API\nservice [green-api.com](https://green-api.com/en/). You should get a registration token and an account ID in\nyour [personal cabinet](https://console.green-api.com/) to use the library. There is a free developer account tariff.\n\n## API\n\nThe documentation for the REST API can be found at the [link](https://green-api.com/en/docs/). The library is a wrapper\nfor 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\nauthorize the account, go to your [cabinet](https://console.green-api.com/) and scan the QR code using the WhatsApp app.\n\n## Example of preparing the environment for Ubuntu Server\n\n### Updating the system\n\nUpdate the system:\n\n```shell\nsudo apt update\nsudo apt upgrade -y\n```\n\n### Java Installation\n\nJava 17 must be installed on the server. [Инструкция по установке Java](https://openjdk.org/install/).\n\n```shell\nsudo apt install openjdk-17-jdk\n```\n\n### Firewall\n\nSet up the firewall:\n\nAllow the SSH connection:\n\n```shell\nsudo ufw allow ssh\n```\n\nBase rules:\n\n```shell\nsudo ufw default deny incoming\nsudo ufw default allow outgoing\n```\n\nAllow HTTP and HTTPS connections:\n\n```shell\nsudo ufw allow http\nsudo ufw allow https\n```\n\nEnable the firewall:\n\n```shell\nsudo ufw enable\n```\n\n## How to run the web server\n\n### Import\n\nInstall the library into your server project. The library is available in the Maven central repository.\n\nMaven\n```xml\n\u003cdependency\u003e\n     \u003cgroupId\u003ecom.green-api\u003c/groupId\u003e\n     \u003cartifactId\u003ewhatsapp-api-webhook-server-java\u003c/artifactId\u003e\n     \u003cversion\u003e{{version}}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle\n```yaml\nimplementation group: 'com.green-api', name: 'whatsapp-api-client-java', version: 'version'\n```\n\n### Examples\n\n#### How to run the web server\n\nSet server options in `application.yml`.\nThe WebhookToken attribute is optional and does not need to be assigned a value, but it must be in `application.yml`.\nIf you don't want to set a password, you can simply leave the webhookToken parameter without a value.\n\n```yaml\ngreen-api:\n  webhookToken:\nserver:\n  port: 8080\n```\n\nApplications will start listening the port immediately after running the `main` method; \nfor this, do not forget to add the `@ComponentScan(basePackages = \"com.greenapi.server\")` annotation.\n\nLink to example: [WhatsappApiServerExample.java](src/main/java/com/greenapi/server/examples/WhatsappApiServerExample.java).\n\n```java\n@SpringBootApplication\n@ComponentScan(basePackages = \"com.greenapi.server\")\npublic class WhatsappApiServerExample {\n     public static void main(String[] args) {\n         SpringApplication.run(WhatsappApiServerExample.class, args);\n     }\n}\n```\n\nThe handler function class must implement the `WebhookHandler` interface and be a bean named `whatsappWebhookHandler`.\nTo do this, set the `@Component(value = \"whatsappWebhookHandler\")` annotation on the handler function class.\n\nLink to example: [WebhookHandlerExample.java](src/main/java/com/greenapi/server/examples/WebhookHandlerExample.java).\n\n```java\n@Component(value = \"whatsappWebhookHandler\")\npublic class WebhookHandlerExample implements WebhookHandler {\n    \n     @SneakyThrows\n     @Override\n     public void handle(Notification notification) {\n         System.out.println(\"START \" + notification);\n         Thread.sleep(20000);\n         System.out.println(\"END \" + notification);\n     }\n}\n```\n\nWebhook URL: `{{your host}}/whatsapp/async/webhook`\nIf you want your `handle()` handler function to be executed asynchronously.\n\nWebhook URL: `{{your host}}/whatsapp/webhook`\nIf you want your `handle()` handler function to be called for each webhook sequentially in one thread.\n\nSince each notification is automatically cast to a java object, you can filter the notification by any field yourself.\nA description of the structure of notification objects can be found at this link: [Documentation](https://green-api.com/docs/api/receiving/notifications-format/type-webhook/)\nFor convenience, all types of hooks and messages are named similarly to the documentation:\n\n| Java object                           | Webhook's json object                                                                                                                                       |\n|---------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `TextMessageWebhook`                  | [TextMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/TextMessage/)                                                |\n| `TemplateMessageWebhook`              | [TemplateMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/TemplateMessage/)                                        |\n| `StickerMessageWebhook`               | [StickerMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/StickerMessage/)                                          |\n| `ReactionMessageWebhook`              | [ReactionMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ReactionMessage/)                                        |\n| `QuotedMessageWebhook`                | [QuotedMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/QuotedMessage/)                                            |\n| `PollUpdateMessageWebhook`            | [PollUpdateMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/PollUpdateMessage/)                                    |\n| `PollMessageWebhook`                  | [PollMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/PollMessage/)                                                |\n| `LocationMessageWebhook`              | [LocationMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/LocationMessage/)                                        |\n| `ListMessageWebhook`                  | [ListMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ListMessage/)                                                |\n| `GroupInviteMessageWebhook`           | [GroupInviteMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/GroupInviteMessage/)                                  |\n| `FileMessageWebhook`                  | [imageMessage, videoMessage, documentMessage, audioMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ImageMessage/) |\n| `ExtendedTextMessageWebhook`          | [ExtendedTextMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ExtendedTextMessage/)                                |\n| `ButtonsMessageWebhook`               | [ButtonsMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ButtonsMessage/)                                          |\n| `ContactMessageWebhook`               | [ContactMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ContactMessage/)                                          |\n| `ContactsArrayMessageWebhook`         | [ContactMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/incoming-message/ContactsArrayMessage/)                                    |\n| `TemplateButtonsReplyMessageWebhook`  | [TemplateButtonsReplyMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/selected-buttons/TemplateButtonsReplyMessage/)                |\n| `ButtonsResponseMessageWebhook`       | [ButtonsResponseMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/selected-buttons/ButtonsResponseMessage/)                          |\n| `ListResponseMessageWebhook`          | [ListResponseMessage](https://greenapi.com/en/docs/api/receiving/notifications-format/selected-buttons/ListResponseMessage/)                                |\n\n\n### Running the application\n\nFor JAR file:\n\n```shell\njava -jar your_app.jar\n```\n\nIf using Maven, run from the project directory:\n\n```shell\n./mvnw spring-boot:run\n```\n\n## Service methods documentation\n\n[Service methods documentation](https://green-api.com/en/docs/api/)\n\n## License\n\nLicensed under [\nAttribution-NoDerivatives 4.0 International (CC BY-ND 4.0)\n](https://creativecommons.org/licenses/by-nd/4.0/) terms.\nPlease see file [LICENSE](LICENSE.txt).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-api%2Fwhatsapp-api-webhook-server-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreen-api%2Fwhatsapp-api-webhook-server-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-api%2Fwhatsapp-api-webhook-server-java/lists"}