{"id":21679761,"url":"https://github.com/whapi-cloud/whatsapp-simple-bot-python","last_synced_at":"2025-03-20T10:23:42.458Z","repository":{"id":264596046,"uuid":"893769513","full_name":"Whapi-Cloud/whatsapp-simple-bot-python","owner":"Whapi-Cloud","description":"Beginner-friendly WhatsApp bot in Python: learn to build a basic bot that responds to commands with text and images. Simple setup, detailed code comments make it easy for new developers to master WhatsApp API integration and bot functionality ","archived":false,"fork":false,"pushed_at":"2024-11-25T08:19:08.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T11:07:02.216Z","etag":null,"topics":["api","api-client","api-rest","begginer","begginer-friendly","begginers","bot","bot-development","chatbot","chatbots","cloud-api","python","whatsapp","whatsapp-api","whatsapp-automation","whatsapp-bot","whatsapp-group","whatsapp-send-message"],"latest_commit_sha":null,"homepage":"https://whapi.cloud","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Whapi-Cloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-25T07:17:12.000Z","updated_at":"2025-01-20T03:59:40.000Z","dependencies_parsed_at":"2024-11-25T09:34:37.779Z","dependency_job_id":null,"html_url":"https://github.com/Whapi-Cloud/whatsapp-simple-bot-python","commit_stats":null,"previous_names":["whapi-cloud/whatsapp-simple-bot-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Whapi-Cloud%2Fwhatsapp-simple-bot-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Whapi-Cloud%2Fwhatsapp-simple-bot-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Whapi-Cloud%2Fwhatsapp-simple-bot-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Whapi-Cloud%2Fwhatsapp-simple-bot-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Whapi-Cloud","download_url":"https://codeload.github.com/Whapi-Cloud/whatsapp-simple-bot-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244592645,"owners_count":20477942,"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":["api","api-client","api-rest","begginer","begginer-friendly","begginers","bot","bot-development","chatbot","chatbots","cloud-api","python","whatsapp","whatsapp-api","whatsapp-automation","whatsapp-bot","whatsapp-group","whatsapp-send-message"],"created_at":"2024-11-25T15:12:30.818Z","updated_at":"2025-03-20T10:23:42.438Z","avatar_url":"https://github.com/Whapi-Cloud.png","language":"Python","readme":"# Simple WhatsApp Bot in Python for Beginners\n\nThis repository contains a basic WhatsApp bot written in Python, ideal for developers who are just starting out. The bot responds to various commands with text messages and images. With straightforward setup steps and detailed comments in the code, this bot is designed to help beginners understand API integration with WhatsApp.\n\n## Getting Started\n\nFollow these steps to set up and run the bot:\n\n### Prerequisites\n\n1. **Get Your API Token**\n   - Obtain an API token from [Whapi.Cloud](https://whapi.cloud) and place it in `.env`.\n\n2. **Set Up Webhook URL**\n   - Get a webhook URL to receive incoming messages. If you need help with setting up the webhook, refer to our knowledge base article [Where to Find the Webhook URL](https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url).\n   - We recommend using a local environment for testing, such as **NGROK**, to expose a local server to the internet.\n1. **Download Ngrok** from the official website and extract it.\n2. Open the terminal and navigate to the folder where Ngrok is stored.\n3. Run `./ngrok http PORT_NUMBER`, replacing `PORT_NUMBER` with the port your Express server is running on locally.\nNow you should have a public URL that you can use as a URL for your webhook.\n   - Set your webhook URL in the **channel settings** on the Whapi.Cloud dashboard.\n  \n3. **Setting Up Your Bot**\nFollow these steps to get the bot running:\n- Navigate to the directory containing the bot’s files: `cd /path/to/bot`\n- Install the required dependencies: `pip install -r requirements.txt`\n- Run the bot: `python index.py`\n\nIf everything is done correctly, your bot is ready to go. Just write the test command “help” to the number connected to the API from another number.   \nFor more detailed instructions on setup and configuration, you can watch our tutorial video on [YouTube](https://youtu.be/GhsRJBXztoc).\n\n***\n\n## Script Overview\n\nThis bot's script contains helpful comments throughout, making it easy to understand the flow and how each function works. Here's a breakdown of the main parts:\n\n- **`files/`**: Stores media files, such as images, that the bot sends.\n- **`.env`**: Contains configuration variables like the API token and base URL.\n- **`index.py`**: The main Python script where the bot’s logic resides.\n- **`requirements.txt`**: Lists all necessary Python packages.\n\n### Main Logic\n\nThis is where the primary logic of the bot resides. It:\n- Filters incoming messages (only non-outgoing messages are processed).\n- Extracts the sender's phone number and the text content of the message.\n- Uses a switch statement to respond with different messages or images based on the command received.\n\n### Additional Information\n\nEach function is commented to make it easier for beginners to understand how the bot works step by step. Should you have any questions or need further assistance, our support team is available and ready to help.\n\nHappy coding!\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhapi-cloud%2Fwhatsapp-simple-bot-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhapi-cloud%2Fwhatsapp-simple-bot-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhapi-cloud%2Fwhatsapp-simple-bot-python/lists"}