Skip to main content

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.

Release files for whatsapp-framework 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whatsapp-framework 0.5.0
File Size Uploaded
whatsapp_framework-0.5.0.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whatsapp-framework 0.5.0
File Interpreter ABI Platform
whatsapp_framework-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.5 kB

Release files / whatsapp_framework-0.5.0.tar.gz

Download URL whatsapp_framework-0.5.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bfe400df0ea1d1e2937fe13e298052882f601f524f1cffd2082e060807001700
BLAKE2b-256 checksum
How to use checksums
430c49435c2cb1178f964eaf0550441b257f0e8265a861bf0ee33c95edf37183
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-124-generic

Release files / whatsapp_framework-0.5.0-py3-none-any.whl

Download URL whatsapp_framework-0.5.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48882899c4e010e02b7fb2f151376d625a31f29e45024fd88d37c97786d543b0
BLAKE2b-256 checksum
How to use checksums
faf8a7ede466b871d6d144907aa65bc06cdcbfeadb780bb55064a0cb1ab34cad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-124-generic

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page