Skip to content

Releases: david-lev/pywa

1.13.0-rc.3

14 Dec 22:54
Compare
Choose a tag to compare
1.13.0-rc.3 Pre-release
Pre-release

What's Changed

Update with pip: pip3 install -U "pywa[cryptography]==1.13.0-rc.3"

  • [errors] adding flows specific errors
  • [flows] allow to @on_flow_request callbacks to return or raise FlowResponseError subclasses

READ MORE AT THE DOCS: https://pywa.readthedocs.io/en/latest/content/flows/overview.html

Full Changelog: 1.13.0-rc.2...1.13.0-rc.3

1.13.0-rc.2

14 Dec 18:09
Compare
Choose a tag to compare
1.13.0-rc.2 Pre-release
Pre-release

What's Changed

Update with pip: pip3 install -U "pywa[cryptography]==1.13.0rc2"

  • [base_update] adding .raw attr to hold the original update
  • [requirements] set cryptography as extra dependency

READ MORE AT THE DOCS: https://pywa.readthedocs.io/en/latest/content/flows/overview.html

Full Changelog: 1.13.0-rc.1...1.13.0-rc.2

1.13.0-rc.1

14 Dec 14:12
Compare
Choose a tag to compare
1.13.0-rc.1 Pre-release
Pre-release

What's Changed

Update with pip: pip3 install -U pywa==1.13.0rc1

READ MORE AT THE DOCS: https://pywa.readthedocs.io/en/latest/content/flows/overview.html

Full Changelog: 1.12.1...1.13.0-rc.1

1.12.1

28 Nov 23:01
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [filters] adding new filter called sent_to to filter updates even if WhatsApp(..., filter_updates=False)
  • [webhook] renaming route callbacks names to allow multiple WhatsApp instances to use the same server
  • [message_type] default missing to UNKNOWN
  • [bugs] fix bug on interactive message without data

Full Changelog: 1.12.0...1.12.1

1.12.0

19 Nov 22:30
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [reply_to_msg] adding ReferredProduct to message context
  • [filters] adding filter for messages that has referred_product in their context
  • [types] unfrozen editable types
  • [base_update] hash updates by their update ID
  • [client] adding dl_session param of type requests.Session to .upload_media when uploading locally from URL
  • [errors] adding more template and flow exceptions; fix typo in TooManyMessages
from pywa import WhatsApp, filters

wa = WhatsApp(...)

@wa.on_message(filters.has_referred_product, filters.text)
def print_product_question(_: WhatsApp, msg: Message):
    sku = msg.reply_to_message.referred_product.sku
    print(f"The user {msg.from_user.name} asked about {sku}: {msg.text}")

Full Changelog: 1.11.1...1.12.0

1.11.1

06 Nov 23:27
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [reaction] hot-fix for reaction when "unreacting" to a message
  • [filters] adding .extensions(...) filter for all media filters
from pywa import WhatsApp, filters

wa = WhatsApp(...)

@wa.on_message(filters.document.extensions('.pdf', '.docx'))
def download_document(client: WhatsApp, msg: Message):
    msg.download_media('/home/david/Downloads/')

Full Changelog: 1.11.0...1.11.1

1.11.0

01 Nov 11:16
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [callback] adding support for Optional[x] annotation in CallbackData subclasses
  • [media] allowing to pass pathlib.Path as a media file path
  • [system] make all fields nullable in system update
from pywa import WhatsApp
from pathlib import Path

wa = WhatsApp(...)
wa.send_document(
    to=972123456789,
    document=Path('/home/david/Documents') / 'Resume.pdf',
    filename='Resume.pdf',
    caption='My Resume',
)

Full Changelog: 1.10.0...1.11.0

1.10.0

29 Oct 16:49
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [template] adding support for OtpType.ZERO_TAP in new authentication template
  • [callback] adding support for nullable and optional fields in CallbackData
  • [tests] update CallbackData tests
import dataclasses
from pywa.types import CallbackData

@dataclasses.dataclass
class User(CallbackData):
    id: str
    name: str | None # nullable field
    is_admin: bool = False # optional field

Full Changelog: 1.9.0...1.10.0

1.9.0

25 Oct 18:31
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [handlers] call .stop_handling() on every update if you want to stop handling the update (or raise pywa.types.StopHandling)
  • [errors] include requests.Response with all api errors
  • [client] mark keyboard argument in .send_message as deprecated. use buttons instead
from pywa import WhatsApp, filters as fil, types

wa = WhatsApp(...)

@wa.on_message(fil.text)
def print_msg_1(_: WhatsApp, msg: types.Message):
    print(msg)
    msg.stop_handling()  # Stop handling the message
    # or raise types.StopHandling

@wa.on_message(fil.text)
def print_msg_2(_: WhatsApp, msg: types.Message):
    print("This handler will never be called")

Full Changelog: 1.8.0...1.9.0

1.8.0

19 Oct 22:47
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

See Handlers for more information.

from pywa import WhatsApp
from flask import Flask
from pywa.types import Message, CallbackButton, Button
from pywa.filters import text, callback

flask_app = Flask(__name__)
wa = WhatsApp(
    phone_id='1234567890',
    token='xxxxxxx',
    server=flask_app,
    callback_url='https://6b3e-18.ngrok.io',
    verify_token='XYZ123',
    app_id=123456,
    app_secret='yyyyyy'
)

# register the handlers

flask_app.run()  # Run the flask app to start the server

Full Changelog: 1.7.3...1.8.0