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.5.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

whatsapp_framework-0.5.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for whatsapp_framework-0.5.0.tar.gz
Algorithm Hash digest
SHA256 bfe400df0ea1d1e2937fe13e298052882f601f524f1cffd2082e060807001700
MD5 48737b75cae63de6e0608898d7862d73
BLAKE2b-256 430c49435c2cb1178f964eaf0550441b257f0e8265a861bf0ee33c95edf37183

See more details on using hashes here.

File details

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

File metadata

  • Download URL: whatsapp_framework-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-124-generic

File hashes

Hashes for whatsapp_framework-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48882899c4e010e02b7fb2f151376d625a31f29e45024fd88d37c97786d543b0
MD5 2942acaf1742df9abe025c532472435e
BLAKE2b-256 faf8a7ede466b871d6d144907aa65bc06cdcbfeadb780bb55064a0cb1ab34cad

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