Skip to main content

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!)

Metadata

Release files for wacpy 0.3.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 wacpy 0.3.0
File Size Uploaded
wacpy-0.3.0.tar.gz 35.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wacpy 0.3.0
File Interpreter ABI Platform
wacpy-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 101.3 kB

Release files / wacpy-0.3.0.tar.gz

Download URL wacpy-0.3.0.tar.gz
Size 35.2 kB
Tags Source
SHA-256 checksum
How to use checksums
009d40e64b50d6fb5b3780453e25bba4e6b09030377cbff5d6e3fc115ed76ac2
BLAKE2b-256 checksum
How to use checksums
82c90f71ca101c9e60f233a7b81cb61b524e2ba1cc79f20ade0206ac0408dcdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / wacpy-0.3.0-py3-none-any.whl

Download URL wacpy-0.3.0-py3-none-any.whl
Size 66.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
060156d913fcde796bd2acc9d2d8870e5e82ff7b44e1fbca621a7d3d4a9fc8c9
BLAKE2b-256 checksum
How to use checksums
ec6f22fb114c29a1d87150b9eccdf08cddca026a283acb18af2e10de0cb2ea29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.3

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