Skip to content

3.6.0

Choose a tag to compare

@david-lev david-lev released this 26 Nov 23:11
· 341 commits to master since this release
49332ae

What's Changed

Update with pip: pip3 install -U pywa

  • [client] allow any media type in update_business_profile(profile_picture=...) arg
  • [sent_message] adding new SentReaction type for replying and reacting to the original message
  • [media] allowing usage in context manager to delete media after use
  • [templates] moving TemplateStatusUpdate fields into objects
  • [message_status] fixing MessageStatus.pricing.type parsing by @Janson-L in #158
  • [utils] bump flow_data_api to 4.0
from pywa import WhatsApp, filters, types

wa = WhatsApp(...)

# media will be automatically deleted from WhatsApp servers after exiting the context
with wa.upload_media("/path/to/sensitive_image.png") as media:
    wa.send_image(to=..., image=media)

@wa.on_message(filters.command("start"))
def on_start(_: WhatsApp, m: types.Message):
    doc = m.reply("Please send your ID as a document.").wait_for_reply(filters=filters.document).document
    # document will be automatically deleted from WhatsApp servers after exiting the context
    with doc:
        # process the document stream securely
        upload_to_secure_storage(file=doc.stream())
from pywa import WhatsApp

wa = WhatsApp(...)

wa.update_business_profile(
    # use any media source supported by pywa
    profile_picture=pathlib.Path("/path/to/image.png")
)

Full Changelog: 3.5.2...3.6.0