Skip to content

1.25.0

Latest
Compare
Choose a tag to compare
@david-lev david-lev released this 15 Aug 16:38
· 31 commits to master since this release

What's Changed

Update with pip: pip3 install -U pywa

  • [handlers] adding priority
  • [client] adding QR methods (create update get and delete)
  • [client] adding get_flow_metrics method
  • [flows] adding to DataSource support for images/colors
  • [flows] support datetime objs in DatePicker
  • [flows] support Screen when using .data_key_of(...) and .form_ref_of(...)
  • [flows] update flow json with indent and without ensuring ascii
  • [flows] adding health_status to FlowDetails
from pywa import WhatsApp, types

wa = WhatsApp(...)

@wa.on_message(filters.text, priority=2)
def one(_: WhatsApp, m: types.Message):
    ...

@wa.on_message(filters.text, priority=3) # will be called before `one`
def two(_: WhatsApp, m: types.Message):
    ...

wa.create_qr_code(prefilled_message="Hi, I am interested in your product", image_type="SVG")

wa.get_flow_metrics(
    flow_id=...,
    metric_name=types.FlowMetricName.ENDPOINT_REQUEST_COUNT,
    granularity=types.FlowMetricGranularity.DAY,
    since=datetime.date(2024, 8, 1),
)

flow = FlowJSON(
    screens=[
        screen_1 := Screen(
            data=[name := ScreenData(key="name", example="David")], # data key in screen_1
            layout=...
        ),
        screen_2 := Screen(
            layout=Layout(
                children=[
                    TextHeading(text=name.data_key_of(screen_1)), # reference to data key in screen_1
                    date := DatePicker(
                        name="date",
                        label="When?",
                        min_date=datetime.date(2024, 8, 1), # date obj in DatePicker 
                        max_date=datetime.date(2024, 8, 30),
                    )
                ]
            ),
        )
    ]
)

Full Changelog: 1.24.0...1.25.0