https://github.com/natanel-shitrit/wacpy
WhatsApp Cloud API Wrapper
https://github.com/natanel-shitrit/wacpy
python python3 whatsapp whatsapp-api whatsapp-api-python whatsapp-bot whatsapp-cloud whatsapp-cloud-api
Last synced: 3 months ago
JSON representation
WhatsApp Cloud API Wrapper
- Host: GitHub
- URL: https://github.com/natanel-shitrit/wacpy
- Owner: Natanel-Shitrit
- License: gpl-3.0
- Archived: true
- Created: 2022-05-28T12:02:04.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-06T06:35:17.000Z (over 2 years ago)
- Last Synced: 2025-01-11T06:56:44.795Z (4 months ago)
- Topics: python, python3, whatsapp, whatsapp-api, whatsapp-api-python, whatsapp-bot, whatsapp-cloud, whatsapp-cloud-api
- Language: Python
- Homepage:
- Size: 145 KB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
#
`wacpy`
Unofficial WhatsApp Cloud API Wrapper
(WIP)[](https://pepy.tech/project/wacpy)
[](https://pypi.org/project/wacpy)
[](https://github.com/Natanel-Shitrit/wacpy/blob/master/LICENSE)
[](https://pypi.org/project/wacpy/)## 📚 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](https://developers.facebook.com/docs/whatsapp/cloud-api/reference)
All other sub-objects exist under this 2 types.
## 🖥 Examples
* A simple message:
```python
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!"
)
)
```
* An Image:
```python
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'
)
)
```
* Interactive Button List
```python
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')
)
)
```
![]()
###### [Click here to see more examples]() (Soon!)