pywa


Namepywa JSON
Version 3.4.0 PyPI version JSON
download
home_pageNone
Summary🚀 Build WhatsApp Bots in Python • Fast, Effortless, Powerful
upload_time2025-10-26 20:12:34
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords whatsapp whatsapp-api whatsapp-cloud-api whatsapp-cloud whatsapp-api-python whatsapp-cloud-api-python pywa wapy wa wa-api wa-cloud-api wa-cloud wa-api-python wa-cloud-api-python whatsapp-webhook whatsapp-webhook-python whatsapp-webhook-api whatsapp-flows whatsapp-cloud-api-flows
VCS
bugtrack_url
requirements httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [//]: # (Logo design by @nyatitilkesh https://github.com/nyatitilkesh | Telegram: @nyatitilkesh)
<p align="center">
  <a href="https://github.com/david-lev/pywa">
    <img src="https://pywa.readthedocs.io/en/latest/_static/pywa-logo.png" width="200" height="200" alt="PyWa Logo"/>
  </a>
</p>

<p align="center">
  <strong>🚀 Build WhatsApp Bots in Python • Fast. Effortless. Powerful.</strong>
</p>

<p align="center">
  <small><em>🤖 Hey there! I am using PyWa.</em></small>
</p>


<p align="center">
  <a href="https://pypi.org/project/pywa/"><img src="https://img.shields.io/pypi/v/pywa.svg" /></a>
  <a href="https://pypi.org/project/pywa/"><img src="https://static.pepy.tech/badge/pywa" /></a>
  <a href="https://github.com/david-lev/pywa/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/david-lev/pywa/tests.yml?label=Tests" /></a>
 <a href="https://pywa.readthedocs.io"><img src="https://readthedocs.org/projects/pywa/badge/?version=latest&" /></a>
  <a href="https://github.com/david-lev/pywa/blob/master/LICENSE"><img src="https://img.shields.io/github/license/david-lev/pywa" /></a>
  <a href="https://www.codefactor.io/repository/github/david-lev/pywa/overview/master"><img src="https://www.codefactor.io/repository/github/david-lev/pywa/badge/master" /></a>
  <a href="https://t.me/py_wa"><img src="https://badges.aleen42.com/src/telegram.svg" /></a>
</p>

---

**💫 PyWa is an all-in-one Python framework for the WhatsApp Cloud API.**

Send **rich media messages**, use **interactive buttons**, listen to **real-time events**, build and send **flows**, design and send **template messages**, and enjoy **blazing-fast async support** with full integration for **FastAPI, Flask**, and more.
Fully **typed**, **documented**, and **production-ready** — build powerful bots in minutes.

---

📄 **Quick Documentation Index**
--------------------------------

> [Get Started](https://pywa.readthedocs.io/en/latest/content/getting-started.html)
• [Client](https://pywa.readthedocs.io/en/latest/content/client/overview.html)
• [Handlers](https://pywa.readthedocs.io/en/latest/content/handlers/overview.html)
• [Listeners](https://pywa.readthedocs.io/en/latest/content/listeners/overview.html)
• [Updates](https://pywa.readthedocs.io/en/latest/content/updates/overview.html)
• [Filters](https://pywa.readthedocs.io/en/latest/content/filters/overview.html)
• [Templates](https://pywa.readthedocs.io/en/latest/content/templates/overview.html)
• [Flows](https://pywa.readthedocs.io/en/latest/content/flows/overview.html)
• [Calls](https://pywa.readthedocs.io/en/latest/content/calls/overview.html)

------------------------

⚡ **Why PyWa?**
---------------
- **🚀 Fast & Simple** – Focus on building, not boilerplate.
- **💬 Rich Messaging** – Text, images, files, audio, locations, contacts, buttons & more.
- **📩 Real-Time Updates** – Messages, callbacks, delivery/read receipts, account updates, and more.
- **🔔 Listeners** – Wait for user replies, clicks, or reactions with ease.
- **📄 Templates** – Create and send powerful WhatsApp templates.
- **♻️ Flows** – Build interactive WhatsApp flows effortlessly.
- **📞 Calls Support** – Receive and handle call events.
- **🔄 Webhook-Ready** – Native support for Flask, FastAPI, and more.
- **🔬 Filters** – Advanced filtering for incoming updates.
- **✅ Production-Ready** – Typed, documented, and fully tested.

------------------------

👨‍💻 **How to Use**
------------------

- **Send a message**
> See [WhatsApp Client](https://pywa.readthedocs.io/en/latest/content/client/overview.html) for all the options.

```python
from pywa import WhatsApp, types

# Create a WhatsApp client
wa = WhatsApp(
    phone_id="100458559237541",
    token="EAAEZC6hUxkTIB"
)

# Send a text message with buttons
wa.send_message(
    to="9876543210",
    text="Hello from PyWa!",
    buttons=[
        types.Button(title="Menu", callback_data="menu"),
        types.Button(title="Help", callback_data="help")
    ]
)

# Send a image message from URL
wa.send_image(
    to="9876543210",
    image="https://example.com/image.jpg",
    caption="Check out this image!",
)
```

- **Handle incoming updates** (with [FastAPI](https://fastapi.tiangolo.com/) in this example)
> See [Handlers](https://pywa.readthedocs.io/en/latest/content/handlers/overview.html) for fully detailed guide.

```python
# wa.py
from pywa import WhatsApp, filters, types
from fastapi import FastAPI

fastapi_app = FastAPI() # FastAPI server

# Create a WhatsApp client
wa = WhatsApp(
    phone_id=1234567890,
    token="************",
    server=fastapi_app, # the server to listen to incoming updates
    callback_url="https://yourdomain.com/",  # the public URL of your server
    verify_token="xyz123", # some random string to verify the webhook
    app_id=123456, # your app id
    app_secret="*******" # your app secret
)

# Register callback to handle incoming messages
@wa.on_message(filters.matches("Hello", "Hi")) # Filter to match text messages that contain "Hello" or "Hi"
def hello(client: WhatsApp, msg: types.Message):
    msg.react("👋") # React to the message with a wave emoji
    msg.reply_text( # Short reply to the message
        text=f"Hello {msg.from_user.name}!", # Greet the user
        buttons=[ # Add buttons to the reply
            types.Button(
                title="About me",
                callback_data="about_me" # Callback data to identify the click
            )
        ]
    )
    # Use the `wait_for_reply` listener to wait for a reply from the user
    age = msg.reply(text="What's your age?").wait_for_reply(filters=filters.text).text
    msg.reply_text(f"Your age is {age}.")

# Register another callback to handle incoming button clicks
@wa.on_callback_button(filters.matches("about_me")) # Filter to match the button click
def click_me(client: WhatsApp, clb: types.CallbackButton):
    clb.reply_text(f"Hello {clb.from_user.name}, I am a WhatsApp bot built with PyWa!") # Reply to the button click
```

- To run the server, use [fastapi-cli](https://fastapi.tiangolo.com/#run-it) (`pip install "fastapi[standard]"`):

```bash
fastapi dev wa.py  # see uvicorn docs for more options (port, host, etc.)
```

- **Async Usage**

- PyWa also supports async usage with the same API. This is useful if you want to use async/await in your code. To use the async version, replace **all** the imports from `pywa` to `pywa_async`:

```python
# wa.py
import fastapi
from pywa_async import WhatsApp, types  # Same API, just different imports

fastapi_app = fastapi.FastAPI()
wa = WhatsApp(..., server=fastapi_app)

async def main():
    await wa.send_message(...) # async call

@wa.on_message
async def hello(_: WhatsApp, msg: types.Message): # async callback
    await msg.react("👋")
    await msg.reply("Hello from PyWa Async!")
```

- **Create and send template messages**
> See [Templates](https://pywa.readthedocs.io/en/latest/content/templates/overview.html) for more details and examples.

```python
from pywa import WhatsApp
from pywa.types.templates import *

wa = WhatsApp(..., business_account_id=123456)

# Create a template
wa.create_template(
    template=Template(
        name="buy_new_iphone_x",
        category=TemplateCategory.MARKETING,
        language=TemplateLanguage.ENGLISH_US,
        parameter_format=ParamFormat.NAMED,
        components=[
            ht := HeaderText("The New iPhone {{iphone_num}} is here!", iphone_num=15),
            bt := BodyText("Buy now and use the code {{code}} to get {{per}}% off!", code="WA_IPHONE_15", per=15),
            FooterText(text="Powered by PyWa"),
            Buttons(
                buttons=[
                    url := URLButton(text="Buy Now", url="https://example.com/shop/{{1}}", example="iphone15"),
                    PhoneNumberButton(text="Call Us", phone_number="1234567890"),
                    qrb1 := QuickReplyButton(text="Unsubscribe from marketing messages"),
                    qrb2 := QuickReplyButton(text="Unsubscribe from all messages"),
                ]
            ),

        ]
    ),
)

# Send the template message
wa.send_template(
    to="9876543210",
    name="buy_new_iphone_x",
    language=TemplateLanguage.ENGLISH_US,
    params=[
        ht.params(iphone_num=30),
        bt.params(code="WA_IPHONE_30", per=30),
        url.params(url_variable="iphone30", index=0),
        qrb1.params(callback_data="unsubscribe_from_marketing_messages", index=1),
        qrb2.params(callback_data="unsubscribe_from_all_messages", index=2),
    ]
)
```

- **Create and send flows**
> See [Flows](https://pywa.readthedocs.io/en/latest/content/flows/overview.html) for much more details and examples.

```python
from pywa import WhatsApp, types
from pywa.types.flows import *

# Create a WhatsApp client
wa = WhatsApp(..., business_account_id=123456)

# Build a flow
my_flow_json = FlowJSON(
    screens=[
        Screen(
            id="NEWSLETTER",
            title="PyWa Newsletter",
            layout=Layout(
                children=[
                    TextHeading(text="Subscribe to our newsletter"),
                    name := TextInput(
                        name="name",
                        label="Name",
                        input_type=InputType.TEXT,
                        required=False,
                    ),
                    email := TextInput(
                        name="email",
                        label="Email",
                        input_type=InputType.EMAIL,
                        required=True,
                    ),
                    Footer(
                        label="Subscribe",
                        on_click_action=CompleteAction(
                            payload={ # Payload to send to the server
                                "name": name.ref,
                                "email": email.ref,
                            }
                        )
                    )
                ]
            )
        )
    ]
)

# Create the flow
wa.create_flow(
    name="subscribe_to_newsletter",
    categories=[FlowCategory.SIGN_UP, FlowCategory.OTHER],
    flow_json=my_flow_json,
    publish=True
)

# Send the flow to a user
wa.send_text(
    to="9876543210",
    text="Hello from PyWa!",
    buttons=types.FlowButton(
        title="Subscribe to our newsletter!",
        flow_name="subscribe_to_newsletter",
    )
)

# Handle the flow response
@wa.on_flow_completion
def handle_flow_response(_: WhatsApp, flow: types.FlowCompletion):
    flow.reply(
        text=f"Thank you for subscribing to our newsletter, {flow.response['name']}! "
             f"We will send you updates to {flow.response['email']}.",
        buttons=[types.Button(title="Unsubscribe", callback_data="unsubscribe")]
    )
```

🎛 **Installation**
--------------------

- **Install using pip3:**

```bash
pip3 install -U pywa
```

- **Install from source (the bleeding edge):**

```bash
pip3 install -U git+https://github.com/david-lev/pywa.git
```

- **If you going to use the webhook features, here is shortcut to install the required dependencies:**

```bash
pip3 install -U "pywa[fastapi]"
pip3 install -U "pywa[flask]"
```

- **If you going to use the Flow features and want to use the default FlowRequestDecryptor and the default FlowResponseEncryptor, here is shortcut to install the required dependencies:**

```bash
pip3 install -U "pywa[cryptography]"
```

💾 **Requirements**
--------------------

- Python 3.10 or higher - https://www.python.org

📖 **Setup and Usage**
-----------------------

See the [Documentation](https://pywa.readthedocs.io/) for detailed instructions


⚖️ **License**
---------------

This project is licensed under the MIT License - see the
[LICENSE](https://github.com/david-lev/pywa/blob/master/LICENSE) file for details


🔱 **Contributing**
--------------------

Contributions are welcome! Please see the [Contributing Guide](https://github.com/david-lev/pywa/blob/master/CONTRIBUTING.md) for more information.

🗣 **Community**
--------------------

Join the [Telegram Group](https://t.me/pywachat) to discuss, ask questions, and share your projects built with PyWa!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pywa",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "whatsapp, whatsapp-api, whatsapp-cloud-api, whatsapp-cloud, whatsapp-api-python, whatsapp-cloud-api-python, pywa, wapy, wa, wa-api, wa-cloud-api, wa-cloud, wa-api-python, wa-cloud-api-python, whatsapp-webhook, whatsapp-webhook-python, whatsapp-webhook-api, whatsapp-flows, whatsapp-cloud-api-flows",
    "author": null,
    "author_email": "David Lev <david@davidlev.dev>",
    "download_url": "https://files.pythonhosted.org/packages/c0/44/85efa2c77d3f0e97606663310faaac3b2a3e83c47dc634ee64ab72b00ae1/pywa-3.4.0.tar.gz",
    "platform": null,
    "description": "[//]: # (Logo design by @nyatitilkesh https://github.com/nyatitilkesh | Telegram: @nyatitilkesh)\n<p align=\"center\">\n  <a href=\"https://github.com/david-lev/pywa\">\n    <img src=\"https://pywa.readthedocs.io/en/latest/_static/pywa-logo.png\" width=\"200\" height=\"200\" alt=\"PyWa Logo\"/>\n  </a>\n</p>\n\n<p align=\"center\">\n  <strong>\ud83d\ude80 Build WhatsApp Bots in Python \u2022 Fast. Effortless. Powerful.</strong>\n</p>\n\n<p align=\"center\">\n  <small><em>\ud83e\udd16 Hey there! I am using PyWa.</em></small>\n</p>\n\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/pywa/\"><img src=\"https://img.shields.io/pypi/v/pywa.svg\" /></a>\n  <a href=\"https://pypi.org/project/pywa/\"><img src=\"https://static.pepy.tech/badge/pywa\" /></a>\n  <a href=\"https://github.com/david-lev/pywa/actions/workflows/tests.yml\"><img src=\"https://img.shields.io/github/actions/workflow/status/david-lev/pywa/tests.yml?label=Tests\" /></a>\n <a href=\"https://pywa.readthedocs.io\"><img src=\"https://readthedocs.org/projects/pywa/badge/?version=latest&\" /></a>\n  <a href=\"https://github.com/david-lev/pywa/blob/master/LICENSE\"><img src=\"https://img.shields.io/github/license/david-lev/pywa\" /></a>\n  <a href=\"https://www.codefactor.io/repository/github/david-lev/pywa/overview/master\"><img src=\"https://www.codefactor.io/repository/github/david-lev/pywa/badge/master\" /></a>\n  <a href=\"https://t.me/py_wa\"><img src=\"https://badges.aleen42.com/src/telegram.svg\" /></a>\n</p>\n\n---\n\n**\ud83d\udcab PyWa is an all-in-one Python framework for the WhatsApp Cloud API.**\n\nSend **rich media messages**, use **interactive buttons**, listen to **real-time events**, build and send **flows**, design and send **template messages**, and enjoy **blazing-fast async support** with full integration for **FastAPI, Flask**, and more.\nFully **typed**, **documented**, and **production-ready** \u2014 build powerful bots in minutes.\n\n---\n\n\ud83d\udcc4 **Quick Documentation Index**\n--------------------------------\n\n> [Get Started](https://pywa.readthedocs.io/en/latest/content/getting-started.html)\n\u2022 [Client](https://pywa.readthedocs.io/en/latest/content/client/overview.html)\n\u2022 [Handlers](https://pywa.readthedocs.io/en/latest/content/handlers/overview.html)\n\u2022 [Listeners](https://pywa.readthedocs.io/en/latest/content/listeners/overview.html)\n\u2022 [Updates](https://pywa.readthedocs.io/en/latest/content/updates/overview.html)\n\u2022 [Filters](https://pywa.readthedocs.io/en/latest/content/filters/overview.html)\n\u2022 [Templates](https://pywa.readthedocs.io/en/latest/content/templates/overview.html)\n\u2022 [Flows](https://pywa.readthedocs.io/en/latest/content/flows/overview.html)\n\u2022 [Calls](https://pywa.readthedocs.io/en/latest/content/calls/overview.html)\n\n------------------------\n\n\u26a1 **Why PyWa?**\n---------------\n- **\ud83d\ude80 Fast & Simple** \u2013 Focus on building, not boilerplate.\n- **\ud83d\udcac Rich Messaging** \u2013 Text, images, files, audio, locations, contacts, buttons & more.\n- **\ud83d\udce9 Real-Time Updates** \u2013 Messages, callbacks, delivery/read receipts, account updates, and more.\n- **\ud83d\udd14 Listeners** \u2013 Wait for user replies, clicks, or reactions with ease.\n- **\ud83d\udcc4 Templates** \u2013 Create and send powerful WhatsApp templates.\n- **\u267b\ufe0f Flows** \u2013 Build interactive WhatsApp flows effortlessly.\n- **\ud83d\udcde Calls Support** \u2013 Receive and handle call events.\n- **\ud83d\udd04 Webhook-Ready** \u2013 Native support for Flask, FastAPI, and more.\n- **\ud83d\udd2c Filters** \u2013 Advanced filtering for incoming updates.\n- **\u2705 Production-Ready** \u2013 Typed, documented, and fully tested.\n\n------------------------\n\n\ud83d\udc68\u200d\ud83d\udcbb **How to Use**\n------------------\n\n- **Send a message**\n> See [WhatsApp Client](https://pywa.readthedocs.io/en/latest/content/client/overview.html) for all the options.\n\n```python\nfrom pywa import WhatsApp, types\n\n# Create a WhatsApp client\nwa = WhatsApp(\n    phone_id=\"100458559237541\",\n    token=\"EAAEZC6hUxkTIB\"\n)\n\n# Send a text message with buttons\nwa.send_message(\n    to=\"9876543210\",\n    text=\"Hello from PyWa!\",\n    buttons=[\n        types.Button(title=\"Menu\", callback_data=\"menu\"),\n        types.Button(title=\"Help\", callback_data=\"help\")\n    ]\n)\n\n# Send a image message from URL\nwa.send_image(\n    to=\"9876543210\",\n    image=\"https://example.com/image.jpg\",\n    caption=\"Check out this image!\",\n)\n```\n\n- **Handle incoming updates** (with [FastAPI](https://fastapi.tiangolo.com/) in this example)\n> See [Handlers](https://pywa.readthedocs.io/en/latest/content/handlers/overview.html) for fully detailed guide.\n\n```python\n# wa.py\nfrom pywa import WhatsApp, filters, types\nfrom fastapi import FastAPI\n\nfastapi_app = FastAPI() # FastAPI server\n\n# Create a WhatsApp client\nwa = WhatsApp(\n    phone_id=1234567890,\n    token=\"************\",\n    server=fastapi_app, # the server to listen to incoming updates\n    callback_url=\"https://yourdomain.com/\",  # the public URL of your server\n    verify_token=\"xyz123\", # some random string to verify the webhook\n    app_id=123456, # your app id\n    app_secret=\"*******\" # your app secret\n)\n\n# Register callback to handle incoming messages\n@wa.on_message(filters.matches(\"Hello\", \"Hi\")) # Filter to match text messages that contain \"Hello\" or \"Hi\"\ndef hello(client: WhatsApp, msg: types.Message):\n    msg.react(\"\ud83d\udc4b\") # React to the message with a wave emoji\n    msg.reply_text( # Short reply to the message\n        text=f\"Hello {msg.from_user.name}!\", # Greet the user\n        buttons=[ # Add buttons to the reply\n            types.Button(\n                title=\"About me\",\n                callback_data=\"about_me\" # Callback data to identify the click\n            )\n        ]\n    )\n    # Use the `wait_for_reply` listener to wait for a reply from the user\n    age = msg.reply(text=\"What's your age?\").wait_for_reply(filters=filters.text).text\n    msg.reply_text(f\"Your age is {age}.\")\n\n# Register another callback to handle incoming button clicks\n@wa.on_callback_button(filters.matches(\"about_me\")) # Filter to match the button click\ndef click_me(client: WhatsApp, clb: types.CallbackButton):\n    clb.reply_text(f\"Hello {clb.from_user.name}, I am a WhatsApp bot built with PyWa!\") # Reply to the button click\n```\n\n- To run the server, use [fastapi-cli](https://fastapi.tiangolo.com/#run-it) (`pip install \"fastapi[standard]\"`):\n\n```bash\nfastapi dev wa.py  # see uvicorn docs for more options (port, host, etc.)\n```\n\n- **Async Usage**\n\n- PyWa also supports async usage with the same API. This is useful if you want to use async/await in your code. To use the async version, replace **all** the imports from `pywa` to `pywa_async`:\n\n```python\n# wa.py\nimport fastapi\nfrom pywa_async import WhatsApp, types  # Same API, just different imports\n\nfastapi_app = fastapi.FastAPI()\nwa = WhatsApp(..., server=fastapi_app)\n\nasync def main():\n    await wa.send_message(...) # async call\n\n@wa.on_message\nasync def hello(_: WhatsApp, msg: types.Message): # async callback\n    await msg.react(\"\ud83d\udc4b\")\n    await msg.reply(\"Hello from PyWa Async!\")\n```\n\n- **Create and send template messages**\n> See [Templates](https://pywa.readthedocs.io/en/latest/content/templates/overview.html) for more details and examples.\n\n```python\nfrom pywa import WhatsApp\nfrom pywa.types.templates import *\n\nwa = WhatsApp(..., business_account_id=123456)\n\n# Create a template\nwa.create_template(\n    template=Template(\n        name=\"buy_new_iphone_x\",\n        category=TemplateCategory.MARKETING,\n        language=TemplateLanguage.ENGLISH_US,\n        parameter_format=ParamFormat.NAMED,\n        components=[\n            ht := HeaderText(\"The New iPhone {{iphone_num}} is here!\", iphone_num=15),\n            bt := BodyText(\"Buy now and use the code {{code}} to get {{per}}% off!\", code=\"WA_IPHONE_15\", per=15),\n            FooterText(text=\"Powered by PyWa\"),\n            Buttons(\n                buttons=[\n                    url := URLButton(text=\"Buy Now\", url=\"https://example.com/shop/{{1}}\", example=\"iphone15\"),\n                    PhoneNumberButton(text=\"Call Us\", phone_number=\"1234567890\"),\n                    qrb1 := QuickReplyButton(text=\"Unsubscribe from marketing messages\"),\n                    qrb2 := QuickReplyButton(text=\"Unsubscribe from all messages\"),\n                ]\n            ),\n\n        ]\n    ),\n)\n\n# Send the template message\nwa.send_template(\n    to=\"9876543210\",\n    name=\"buy_new_iphone_x\",\n    language=TemplateLanguage.ENGLISH_US,\n    params=[\n        ht.params(iphone_num=30),\n        bt.params(code=\"WA_IPHONE_30\", per=30),\n        url.params(url_variable=\"iphone30\", index=0),\n        qrb1.params(callback_data=\"unsubscribe_from_marketing_messages\", index=1),\n        qrb2.params(callback_data=\"unsubscribe_from_all_messages\", index=2),\n    ]\n)\n```\n\n- **Create and send flows**\n> See [Flows](https://pywa.readthedocs.io/en/latest/content/flows/overview.html) for much more details and examples.\n\n```python\nfrom pywa import WhatsApp, types\nfrom pywa.types.flows import *\n\n# Create a WhatsApp client\nwa = WhatsApp(..., business_account_id=123456)\n\n# Build a flow\nmy_flow_json = FlowJSON(\n    screens=[\n        Screen(\n            id=\"NEWSLETTER\",\n            title=\"PyWa Newsletter\",\n            layout=Layout(\n                children=[\n                    TextHeading(text=\"Subscribe to our newsletter\"),\n                    name := TextInput(\n                        name=\"name\",\n                        label=\"Name\",\n                        input_type=InputType.TEXT,\n                        required=False,\n                    ),\n                    email := TextInput(\n                        name=\"email\",\n                        label=\"Email\",\n                        input_type=InputType.EMAIL,\n                        required=True,\n                    ),\n                    Footer(\n                        label=\"Subscribe\",\n                        on_click_action=CompleteAction(\n                            payload={ # Payload to send to the server\n                                \"name\": name.ref,\n                                \"email\": email.ref,\n                            }\n                        )\n                    )\n                ]\n            )\n        )\n    ]\n)\n\n# Create the flow\nwa.create_flow(\n    name=\"subscribe_to_newsletter\",\n    categories=[FlowCategory.SIGN_UP, FlowCategory.OTHER],\n    flow_json=my_flow_json,\n    publish=True\n)\n\n# Send the flow to a user\nwa.send_text(\n    to=\"9876543210\",\n    text=\"Hello from PyWa!\",\n    buttons=types.FlowButton(\n        title=\"Subscribe to our newsletter!\",\n        flow_name=\"subscribe_to_newsletter\",\n    )\n)\n\n# Handle the flow response\n@wa.on_flow_completion\ndef handle_flow_response(_: WhatsApp, flow: types.FlowCompletion):\n    flow.reply(\n        text=f\"Thank you for subscribing to our newsletter, {flow.response['name']}! \"\n             f\"We will send you updates to {flow.response['email']}.\",\n        buttons=[types.Button(title=\"Unsubscribe\", callback_data=\"unsubscribe\")]\n    )\n```\n\n\ud83c\udf9b **Installation**\n--------------------\n\n- **Install using pip3:**\n\n```bash\npip3 install -U pywa\n```\n\n- **Install from source (the bleeding edge):**\n\n```bash\npip3 install -U git+https://github.com/david-lev/pywa.git\n```\n\n- **If you going to use the webhook features, here is shortcut to install the required dependencies:**\n\n```bash\npip3 install -U \"pywa[fastapi]\"\npip3 install -U \"pywa[flask]\"\n```\n\n- **If you going to use the Flow features and want to use the default FlowRequestDecryptor and the default FlowResponseEncryptor, here is shortcut to install the required dependencies:**\n\n```bash\npip3 install -U \"pywa[cryptography]\"\n```\n\n\ud83d\udcbe **Requirements**\n--------------------\n\n- Python 3.10 or higher - https://www.python.org\n\n\ud83d\udcd6 **Setup and Usage**\n-----------------------\n\nSee the [Documentation](https://pywa.readthedocs.io/) for detailed instructions\n\n\n\u2696\ufe0f **License**\n---------------\n\nThis project is licensed under the MIT License - see the\n[LICENSE](https://github.com/david-lev/pywa/blob/master/LICENSE) file for details\n\n\n\ud83d\udd31 **Contributing**\n--------------------\n\nContributions are welcome! Please see the [Contributing Guide](https://github.com/david-lev/pywa/blob/master/CONTRIBUTING.md) for more information.\n\n\ud83d\udde3 **Community**\n--------------------\n\nJoin the [Telegram Group](https://t.me/pywachat) to discuss, ask questions, and share your projects built with PyWa!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83d\ude80 Build WhatsApp Bots in Python \u2022 Fast, Effortless, Powerful",
    "version": "3.4.0",
    "project_urls": {
        "Changelog": "https://github.com/david-lev/pywa/blob/master/CHANGELOG.md",
        "Documentation": "https://pywa.readthedocs.io/",
        "Funding": "https://github.com/sponsors/david-lev",
        "Issue Tracker": "https://github.com/david-lev/pywa/issues",
        "Source Code": "https://github.com/david-lev/pywa"
    },
    "split_keywords": [
        "whatsapp",
        " whatsapp-api",
        " whatsapp-cloud-api",
        " whatsapp-cloud",
        " whatsapp-api-python",
        " whatsapp-cloud-api-python",
        " pywa",
        " wapy",
        " wa",
        " wa-api",
        " wa-cloud-api",
        " wa-cloud",
        " wa-api-python",
        " wa-cloud-api-python",
        " whatsapp-webhook",
        " whatsapp-webhook-python",
        " whatsapp-webhook-api",
        " whatsapp-flows",
        " whatsapp-cloud-api-flows"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a7f477cb1a14dcccb42ef66f2355438c4529fa6fc289717349cd910bea0e656d",
                "md5": "6811ad5b7301f77b95c817facdbaefc3",
                "sha256": "a26f0d352b87108156da11b788aa698918ea4de926b2dece038af8bda580ce24"
            },
            "downloads": -1,
            "filename": "pywa-3.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6811ad5b7301f77b95c817facdbaefc3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 291464,
            "upload_time": "2025-10-26T20:12:32",
            "upload_time_iso_8601": "2025-10-26T20:12:32.713190Z",
            "url": "https://files.pythonhosted.org/packages/a7/f4/77cb1a14dcccb42ef66f2355438c4529fa6fc289717349cd910bea0e656d/pywa-3.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c04485efa2c77d3f0e97606663310faaac3b2a3e83c47dc634ee64ab72b00ae1",
                "md5": "5e2a3892bf549d9876cc6e0917f0a7e7",
                "sha256": "07865557ad508374a200e8a671dd9bed0d24b3ca1e3eec06e3a2f89117914f11"
            },
            "downloads": -1,
            "filename": "pywa-3.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5e2a3892bf549d9876cc6e0917f0a7e7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 298825,
            "upload_time": "2025-10-26T20:12:34",
            "upload_time_iso_8601": "2025-10-26T20:12:34.454679Z",
            "url": "https://files.pythonhosted.org/packages/c0/44/85efa2c77d3f0e97606663310faaac3b2a3e83c47dc634ee64ab72b00ae1/pywa-3.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-26 20:12:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "david-lev",
    "github_project": "pywa",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "httpx",
            "specs": [
                [
                    ">=",
                    "0.27.0"
                ]
            ]
        }
    ],
    "lcname": "pywa"
}
        
Elapsed time: 2.71133s