Skip to main content

Whatsapp framework simplifies building and deploying whatsapp based application

Project description

Whatsapp Framework

Whatsapp Framework simplifies building and deploying whatsapp based applications.

Installation

pip install whatsapp-framework

Example Usage

Here's a basic example of how to use Whatsapp Framework:

from whatsapp.events import Message
from whatsapp.chat import ChatHandler
from whatsapp.reply_message import Message as ReplyMessage, Text


class SimpleChatHandler(ChatHandler):
    token = "<whatsapp_access_token>"
    whatsapp_number = "<whatsapp_phone_number>"

    def on_message(self, message: Message):
        message_type = message.type
        file = message.message.file
        name = message.contacts[0].profile.name

        req = ReplyMessage(
            type="text",
            to=message.to,
            text=Text(
                preview_url=False,
                body=f"""
Hello, {name}!

I received a {message_type} from you.
I've saved it as {file}.
"""
            ),
        )
        self.send(req)


def main():
    chat_handler = SimpleChatHandler(debug=True, start_proxy=False)
    chat_handler.start()


if __name__ == "__main__":
    main()

License

Whatsapp Framework is licensed under the MIT License. See the LICENSE file for details.

Contact

If you have any questions or need support, please open an issue on GitHub Issues or contact us at support@ravenconsulting.site.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whatsapp_framework-0.1.12.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

whatsapp_framework-0.1.12-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file whatsapp_framework-0.1.12.tar.gz.

File metadata

  • Download URL: whatsapp_framework-0.1.12.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-119-generic

File hashes

Hashes for whatsapp_framework-0.1.12.tar.gz
Algorithm Hash digest
SHA256 b5d56819a63e8de7dc960b8670d86fa505868c1013ccb968447a3d58aea60f3d
MD5 175ce1a50f1bbdaec761173243d2b3bf
BLAKE2b-256 22c70aad93168d6e8331700e2d29b56ae947e974fdd18671e44e0d330b9e03be

See more details on using hashes here.

File details

Details for the file whatsapp_framework-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for whatsapp_framework-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 9ab8cf68dbc5bae5efbda79bade7bd87cd55f287bce2d49c2a0fc316b82c4abb
MD5 aa095c4119194246f01f44350facf951
BLAKE2b-256 f8e87bbda9793dc25ad16c981fec49faca358b2de7953db127c2150322477fbf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page