Skip to content

Releases: david-lev/pywa

1.18.0

02 May 13:17
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [client] allow to modify token and remove handlers/callbacks
  • [tests] test client methods

Full Changelog: 1.17.0...1.18.0

1.17.0

30 Apr 01:11
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [client,message_status] Added param tracker to all send-message-methods in order to track the message status, allowing to pass CallbackData subclasses totracker param
  • [client,api] adding update_conversational_automation and get_business_phone_number to add and get commands, ice_breakers and enable ChatOpened events
  • [filters] adding send_to_me filters shortcut and replays_to filters. mark as deprecated all match-specific-type filters and create generic matches, regex filters for all text containing updates
  • [flows] adding updated_at to FlowDetails
  • [message] fix from_user in system messages
  • [errors] adding optionals error_subcode and type to all errors
  • [logging] improve loggers performance
  • [utils] bump graph api version to 19.0 and expose Version in the package level
  • [docs] switch readme to markdown
from pywa import WhatsApp, types, filters

wa = WhatsApp(...)

wa.send_message(
    to="972123456789",
    text="Hello from pywa!",
    tracker="my_tracker",
)

@wa.on_message_status(filters.matches("my_tracker"))
def on_status(_: WhatsApp, status: types.MessageStatus):
    print(status.tracker)
from pywa import WhatsApp
from pywa.types import Command

wa = WhatsApp(...)

wa.update_conversational_automation(
    enable_chat_opened=True,
    ice_breakers=[
        "Generate me an image of a cute cat",
        "Create a beautiful image of a sunset",
    ],
    commands=[
        Command(name="imagine", description="Create images using a text prompt"),
        Command(name="contact", description="Contact us",),
    ]
)

Full Changelog: 1.16.2...1.17.0

1.16.2

15 Feb 08:01
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [client] fix sending single contact
  • [filters] prioritize / over ! in filters.command(...) and filters.is_command

Full Changelog: 1.16.0...1.16.2

1.16.0

22 Jan 21:37
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [chat_opened] adding a new type: ChatOpened
  • [server] improve handlers and logs
  • [types] warning on missing enum constant
  • [flows] handle cases where there is no flow_token in FlowCompletion (When the flow completion sent from iOS)
  • [tests] adding more tests
from pywa import WhatsApp
from pywa.types import ChatOpened
from flask import Flask

flask_app = Flask(__name__)

wa = WhatsApp(..., server=flask_app, verify_token=...)

@wa.on_chat_opened()
def handle_chat_opened(_: WhatsApp, chat_opened: ChatOpened):
    chat_opened.reply(f"Hello, {chat_opened.from_user.name}. Welcome to our bot!")

Full Changelog: 1.15.0...1.16.0

1.15.0

14 Jan 00:43
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [client] added register_phone_number by @yehuda-lev in #34
  • [client] mark the body arg in send image/video/doc as deprecated. use caption instead
  • [utils] bump FLOW_JSON version to 3.1
  • [flows] allow DataSource in FlowResponse data
  • [flows] Image .src can be dynamic
  • [flows] default ActionNext to SCREEN
  • [flows] adding .success for screen and adding in-docs examples

Full Changelog: 1.14.0...1.15.0

1.14.0

01 Jan 11:07
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [flows] define Form init_values from children init_value
  • [flows] adding a new ScreenData type to be used in screen .data
  • [flows] adding .form_ref and .form_ref_of(form_name) to form components
  • [docs] adding s real-world example for a complex flow
flow = FlowJSON(
    screens=[
        Screen(
            id="WELCOME",
            title="Welcome",
            terminal=True,
            data=[
                welcome_header := ScreenData(key="welcome_header", example="Welcome to the demo!"),
                initial_name := ScreenData(key="initial_name", example="David"),
            ],
            layout=Layout(
                children=[
                    TextHeading(text=welcome_header.data_key),
                    Form(
                        name="form",
                        children=[
                            name := TextInput(
                                name="name",
                                label="Name",
                                required=True,
                                init_value=initial_name.data_key,
                            ),
                            email := TextInput(
                                name="email",
                                label="Email",
                                input_type=InputType.EMAIL,
                                required=True,
                            )
                        ]
                    ),
                    Footer(
                        label="Done",
                        on_click_action=Action(
                            name=FlowActionType.COMPLETE,
                            payload={
                                "name": name.form_ref,
                                "email": email.form_ref,
                            }
                        )
                    )
                ]
            )
        )
    ]
)

Full Changelog: 1.13.0...1.14.0

1.13.0

22 Dec 12:47
Compare
Choose a tag to compare

What's Changed

Update with pip: pip3 install -U pywa

  • [flows] Adding full support for WhatsApp Flows!
  • [client] adding request_location method to WhatsApp client by @yehuda-lev in #29
  • [base_update] adding .raw attr to hold the original update
  • [utils] adding Version to provide the latest versions to the api & flows, and to perform min checks

Full Changelog: 1.12.1...1.13.0

1.13.0-rc.5

18 Dec 11:43
Compare
Choose a tag to compare
1.13.0-rc.5 Pre-release
Pre-release

What's Changed

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

  • [flows] add supported types for Layout and Form .children and fix FlowPreview.expires_at
  • [webhook] validate cryptography is installed when using the default flows decryptor/encryptor

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

Full Changelog: 1.13.0-rc.4...1.13.0-rc.5

1.13.0-rc.4

16 Dec 20:39
Compare
Choose a tag to compare
1.13.0-rc.4 Pre-release
Pre-release

What's Changed

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

  • [client] expose set_business_public_key
  • [flows] adding DataKey and FormRef to use when building a FlowJSON
  • [template] adding support to create and send template with FlowButton
  • [errors] remove FlowInvalidError (Too broad error code)

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

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

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