What's Changed
Update with pip:
pip3 install -U pywa
- [flows] adding support for
ChipsSelector
component - [flows]
flow_name
instead offlow_id
while sending.flow_token
is now optional - [client] allowing to create flow with flow json and publish it with one request
- [utils] update flow json latest version to 6.3
chips_selector = FlowJSON(
version="6.3",
screens=[
Screen(
id="DEMO_SCREEN",
terminal=True,
title="Demo screen",
layout=Layout(
children=[
chips := ChipsSelector(
name="chips",
label="Personalize your experience",
description="Choose your interests to get personalized design ideas and solution",
max_selected_items=2,
data_source=[
DataSource(id="room_layout", title="π‘ Room layouts"),
DataSource(id="lighting", title="π‘ Lighting"),
DataSource(id="renovation", title="π οΈ Renovation"),
DataSource(id="furnitures", title="π Room layouts"),
],
),
Footer(
label="Continue",
on_click_action=CompleteAction(
payload={
"chips": chips.ref,
}
),
),
],
),
),
],
)
from pywa import WhatsApp, types
wa = WhatsApp(...)
wa.create_flow(
name="my_flow",
categories=[types.FlowCategory.CUSTOMER_SUPPORT, types.FlowCategory.CONTACT_US],
endpoint_uri="https://my-server.com/my-flow",
flow_json=FlowJSON(...), # You can now set the json while creating the flow
publish=True # You can now publish the flow while creating it
)
wa.send_text(
to="...",
text="Let's get started!",
buttons=types.FlowButton(
title="Start",
flow_name="my_flow", # You can now use the flow name instead of the flow id
# flow_token="my_flow_token", # Flow token is now optional, default is `unused`
flow_action_screen="FIRST_SCREEN",
)
)
Full Changelog: 2.6.0...2.7.0