GithubHelp home page GithubHelp logo

natanel-shitrit / wacpy Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 2.0 148 KB

WhatsApp Cloud API Wrapper

License: GNU General Public License v3.0

Python 100.00%
whatsapp whatsapp-api whatsapp-bot whatsapp-cloud whatsapp-cloud-api python whatsapp-api-python python3

wacpy's Introduction

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.

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

wacpy's People

Contributors

natanel-shitrit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wacpy's Issues

Typo in `Addresses` property in the `Contact` object

Currently, the property is named adresses, this should be addresses.

Opening this issue only I stumbled upon this while updating wacpy to the the new API version, and I don't want to forget to fix this after merging the new API version branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.