{"id":20238194,"url":"https://github.com/basilfx/python-whatsappy","last_synced_at":"2025-04-10T19:24:26.014Z","repository":{"id":17062013,"uuid":"19826711","full_name":"basilfx/python-whatsappy","owner":"basilfx","description":"An unofficial Python API for connecting with the WhatsApp chat protocol (deprecated).","archived":false,"fork":false,"pushed_at":"2015-08-11T06:33:16.000Z","size":264,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T17:01:46.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/basilfx.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}},"created_at":"2014-05-15T16:25:04.000Z","updated_at":"2024-09-19T16:30:15.000Z","dependencies_parsed_at":"2022-07-26T12:02:08.990Z","dependency_job_id":null,"html_url":"https://github.com/basilfx/python-whatsappy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fpython-whatsappy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fpython-whatsappy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fpython-whatsappy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fpython-whatsappy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basilfx","download_url":"https://codeload.github.com/basilfx/python-whatsappy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281387,"owners_count":21077423,"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":[],"created_at":"2024-11-14T08:32:13.847Z","updated_at":"2025-04-10T19:24:25.994Z","avatar_url":"https://github.com/basilfx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-whatsappy\nAn unoffical Python API for connecting with the WhatsApp chat protocol.\n\n## Installation\nClone this repository, and install it via `python setup.py install`.\n\n## Usage\nThe API is callback driven and easy to use. It interfaces with version 1.5 of\nthe WhatsApp protocol. You should provide your own number and secret, which you\ncan intercept from a real phone.\n\nExample code is provided below. It registers three callbacks.\n\n```\nimport whatsappy\n\n# Create instance\nclient = whatsappy.Client(number=\u003cnumber\u003e, secret=\u003csecret\u003e, nickname=\u003cnickname\u003e)\n\n# Callbacks handlers\ndef on_message(node):\n    message = node.child(\"body\").data\n    sender = node[\"from\"]\n\n    # Print response to terminal\n    print \"%s: %s\" % (sender, message)\n\n    # Reply\n    if \"-\" not in sender:\n        client.message(sender, message)\n\ndef on_presence(node):\n    print \"%s is %s\" % (node.get(\"from\"), node.get(\"type\", \"online\"))\n\ndef on_chat_state(node):\n    if node.children[0].name == \"composing\":\n        print \"%s is typing\" % node.get(\"from\")\n    else:\n        print \"%s stopped typing\" % node.get(\"from\")\n\n# Register callbacks\nclient.register_callback(\n    whatsappy.TextMessageCallback(on_message, single=True, group=True),\n    whatsappy.PresenceCallback(on_presence, online=True, offline=True),\n    whatsappy.ChatStateCallback(on_chat_state, composing=True, paused=True)\n)\n\n# Start it all\nclient.connect()\n```\n\nOne can examining of raw messages by turning on debug. Other messages are logged\nvia Python's default logger.\n\n```\nclient.debug = True\n```\n\nThis module does not provide any method to generate a login secret. You should\nprovide it yourself, e.g. intercept it from your phone.\n\n## Tests\nThe unit tests can be invoked via `python -m unittest discover tests '*.py'`\n\n## License\nReleased under the MIT License\n\nCopyright (C) 2012 Paul Hooijenga (Original author, https://github.com/hackedd)\n\nCopyright (C) 2014-2015 Bas Stottelaar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n## Disclaimer\nWhatsApp is a registered trademark of WhatsApp Inc. registered in the U.S. and\nother countries. This project is an independent work and has not been\nauthorized, sponsored, or otherwise approved by Whatsapp Inc.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasilfx%2Fpython-whatsappy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasilfx%2Fpython-whatsappy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasilfx%2Fpython-whatsappy/lists"}