Skip to main content

WhatsApp Cloud API Wrapper

Project description

wacpy

Unofficial WhatsApp Cloud API Wrapper
(WIP)

Downloads Supported Versions License Version

📚 About

wacpy aims to be a complete python wrapper for the WhatsApp Cloud API.

⚙ Usage

Currently, wacpy is only providing WhatsApp Cloud API objects.

The 2 main objects are:

📃 Message: (wacpy.types.message.Message)

The Message object is used to craft messages.

🔔 Notification: (wacpy.types.notification.Notification)

The Notification object is the object that gets sent to your webhook.

Images taken from Official WhatsApp Cloud API Refrence

All other sub-objects exist under this 2 types.

🖥 Examples

  • A simple message:
from wacpy.types.message import Message, message # You can also import `message` from `wacpy.types`

Message(
    to='{{WHATSAPP_PHONE_NUMBER}}',
    text=message.Text(
        body="This is a simple message!"
    )
)

image

  • An Image:
from wacpy.types import Message, message # You can also import `message` from `wacpy.types`

Message(
    to='{{WHATSAPP_PHONE_NUMBER}}',
    type='image',
    image=message.Media(
        link='https://i.imgur.com/Zf5eagv.png',
        caption='Some cute cats'
    )
)

image

  • Interactive Button List
from wacpy.types import Message, message # You can also import `message` from `wacpy.types`

Message(
    to='{{WHATSAPP_PHONE_NUMBER}}',
    type='interactive',
    interactive=message.Interactive(
        type='list',
        action=message.interactive.Action(
            button='List',
            sections=[
                message.interactive.action.Section(
                    title='First Section',
                    rows=[
                        message.interactive.action.section.Row(
                            id='first_row',
                            title='First Row',
                            description='This is the first row description',
                        ),
                        message.interactive.action.section.Row(
                            id='second_row',
                            title='Second Row',
                            description='This is the second row description',
                        )
                    ]
                ),
                message.interactive.action.Section(
                    title='Second Section',
                    rows=[
                        message.interactive.action.section.Row(
                            id='first_row',
                            title='First Row',
                            description='This is the first row description',
                        ),
                        message.interactive.action.section.Row(
                            id='second_row',
                            title='Second Row',
                            description='This is the second row description',
                        )
                    ]
                )
            ]
        ),
        body=message.interactive.Body('This is the body text')
    )
)

image

Click here to see more examples (Soon!)

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

wacpy-0.2.8.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wacpy-0.2.8-py3-none-any.whl (59.8 kB view details)

Uploaded Python 3

File details

Details for the file wacpy-0.2.8.tar.gz.

File metadata

  • Download URL: wacpy-0.2.8.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for wacpy-0.2.8.tar.gz
Algorithm Hash digest
SHA256 2fb0f2abee28147520ccfb6301c6ebed84f9809431151cd23f2da2d8a082dbd3
MD5 ad358d6df493e0e3f4f7197a72d28cb3
BLAKE2b-256 883047aa085e615df184c6db4b1a5dafb1da78bf7fef780e759e72d6d16644d5

See more details on using hashes here.

File details

Details for the file wacpy-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: wacpy-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 59.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for wacpy-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4c524adc08f567278df8a06f34bb71ce8f02b15fa3d14595eb8803dd9656c8f6
MD5 1a905008cea68460cc99b0026d5bafee
BLAKE2b-256 766c9d49fd0f92838e812b3deae251e7b180707bf4015d109e48a0d6a0e88c85

See more details on using hashes here.

Supported by

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