{"id":14987073,"url":"https://github.com/green-api/whatsapp-chatbot-js","last_synced_at":"2026-01-03T15:14:02.354Z","repository":{"id":56841666,"uuid":"313376269","full_name":"green-api/whatsapp-chatbot-js","owner":"green-api","description":"The library to develop WhatsApp bot ","archived":false,"fork":false,"pushed_at":"2024-03-11T22:59:31.000Z","size":1685,"stargazers_count":30,"open_issues_count":9,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T09:09:10.915Z","etag":null,"topics":["bot","bot-framework","botapi","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-bot-api","whatsapp-chat"],"latest_commit_sha":null,"homepage":"https://green-api.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","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":"2020-11-16T17:23:43.000Z","updated_at":"2025-03-16T17:20:01.000Z","dependencies_parsed_at":"2024-06-21T20:14:35.579Z","dependency_job_id":"baccbd07-d684-48d5-84d0-09b53f232fa3","html_url":"https://github.com/green-api/whatsapp-chatbot-js","commit_stats":null,"previous_names":["green-api/whatsapp-bot"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-chatbot-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-chatbot-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-chatbot-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-api%2Fwhatsapp-chatbot-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/green-api","download_url":"https://codeload.github.com/green-api/whatsapp-chatbot-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493044,"owners_count":21113189,"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":["bot","bot-framework","botapi","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-bot-api","whatsapp-chat"],"created_at":"2024-09-24T14:14:03.108Z","updated_at":"2026-01-03T15:14:02.324Z","avatar_url":"https://github.com/green-api.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WhatsApp chat bot library for nodejs\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/green-api/whatsapp-bot/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/v/release/green-api/whatsapp-bot.svg)](https://github.com/green-api/whatsapp-bot/releases)\n[![npm version](https://badge.fury.io/js/%40green-api%2Fwhatsapp-bot.svg)](https://www.npmjs.com/package/@green-api/whatsapp-bot)\n\n\n## Introduction\n\nThe WhatsApp chat bot designed for writing own chat bots. Users can interact with bots by sending them command messages in private or group chats. The bot uses Green-API ([green-api.com](https://green-api.com)) provider WhatsApp API protocol under hood to support WhatsApp. Green API whatsApp protocol exists in two versions: \n* V0 - requires plugged and active phone. The protocol provides reach WhatsApp API including messages, media, phone state, location etc. Have look at  [whatsapp-api-client](https://github.com/green-api/whatsapp-api-client) wrapper REST protocol library for more information\n- V1  - phone-free protocol that requires only phone number without physical device. The protocol implements only limited part of WhatsApp API. See details here [v1-whatsapp-api-client](https://github.com/green-api/v1-whatsapp-api-client) \n\n## Installation\n\n```\nnpm i @green-api/whatsapp-bot\n```\n\n## Getting started  \n\n### 1. Get green api account\n\nTo use the WhatsApp Bot API, you first have to visit [green-api.com](https://green-api.com) and get free developer account for API-V0. Green Api will give you id instance and api token, something like \n```\nID_INSTANCE: \"0000\",\nAPI_TOKEN_INSTANCE: \"000000000000000000AAAAAAAAAAAAAA\"\n```\n\nIn case you want API-V1 protocol you also have to visit [green-api.com](https://green-api.com) and choose Chat bot price option. Green API will give you a free trial period if you ask them. Access token looks like this:\n```\ntoken = 'gr.abcdefg...'\n```\n\n### 2. Add import\n\nYou can import library using modern ES6 syntax (you have to add ``\"type\":\"module\"`` to ``package.json``):\n```\nimport WhatsAppBot from '@green-api/whatsapp-bot'\n```\nor using classic syntax:\n```\nconst WhatsAppBot = require('@green-api/whatsapp-bot')\n```\n### 3. Initiliaze new WhatsApp Bot with aquired account data\n\nFor API-V0 protocol\n```\nconst bot = new WhatsAppBot({\n    idInstance: \"0000\",\n    apiTokenInstance: \"000000000000000000AAAAAAAAAAAAAA\"\n})\n```\nFor API-V1 protocol\n```\nconst bot = new WhatsAppBot(process.env.TOKEN_V1, {apiType: WhatsAppBot.GreenApiV1})\n```\n\n### 3. Start coding\n\nA WhatsApp bot was inpired by telegram bot framework - [Telegraf](https://telegraf.js.org). But the WhatsApp bot library inherited limited part of Telegraf API. At this moment whatsapp bot can send and receive text, interact with user by telegraf scenes and use sessions. The bot supports only long-polling mode. To understand basics have look at examples below.\n\n### Examples\nHello world example responds with a plain text phrase to any users print:\n\n```js\nconst WhatsAppBot = require('@green-api/whatsapp-bot')\n\nconst bot = new WhatsAppBot({\n    idInstance: process.env.ID_INSTANCE,\n    apiTokenInstance: process.env.API_TOKEN_INSTANCE\n})\nbot.on('message', (ctx) =\u003e ctx.reply('Hello world!'))\nbot.launch()\n```\nBot listens for users command beginning with the / symbol\n```js\nconst WhatsAppBot = require('@green-api/whatsapp-bot')\n\nconst bot = new WhatsAppBot({\n    idInstance: process.env.ID_INSTANCE,\n    apiTokenInstance: process.env.API_TOKEN_INSTANCE\n})\nbot.command('oldschool', (ctx) =\u003e ctx.reply('Hello'))\nbot.command('modern', ({ reply }) =\u003e reply('Yo'))\nbot.command('hipster', WhatsAppBot.reply('λ'))\nbot.on('message', (ctx) =\u003e ctx.reply('Send /oldschool, /modern or /hipster to launch bot'))\nbot.launch()\n```\n\nThere's some cool V0-V1 api [examples too](docs/examples/). The bots are great for running in docker containers. Take a look at dockerized [simple-reg-bot example](https://github.com/green-api/simple-reg-bot)\n\n## Documentation\n\n### Receive webhooks via HTTP API\n\nYou can get incoming webhooks (messages, statuses) via HTTP API requests in the similar way as the rest of the Green API methods are implemented. Herewith, the chronological order of the webhooks following is guaranteed in the sequence in which they were received FIFO. All incoming webhooks are stored in the queue and are expected to be received within 24 hours.\n\nTo get incoming webhooks, you have to sequentially call two methods \u003ca href=\"https://green-api.com/en/docs/api/receiving/technology-http-api/ReceiveNotification/\"\u003eReceiveNotification\u003c/a\u003e and \u003ca href=\"https://green-api.com/en/docs/api/receiving/technology-http-api/DeleteNotofication/\"\u003eDeleteNotification\u003c/a\u003e. ReceiveNotification method receives an incoming webhook. DeleteNotification method confirms successful webhook receipt and processing. To learn more about the methods, refer to respective ReceiveNotification and DeleteNotification sections.\n\n* [API reference](docs/README.MD)\n\n## License\n\nLicensed on MIT terms. For additional info have look at [LICENSE](LICENSE)\n\n## Third-party libraries\n\n* [@green-api/whatsapp-api-client](https://github.com/green-api/whatsapp-api-client) -  WhatsApp API client wrapper for [green-api.com](https://green-api.com)\n* [Telegraf](https://github.com/telegraf/telegraf) - Modern Telegram Bot Framework for Node.js. You shall accept the [License](https://github.com/telegraf/telegraf/blob/develop/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-api%2Fwhatsapp-chatbot-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreen-api%2Fwhatsapp-chatbot-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-api%2Fwhatsapp-chatbot-js/lists"}