Skip to content

2.7.0

Latest
Compare
Choose a tag to compare
@david-lev david-lev released this 18 Jan 19:41

What's Changed

Update with pip: pip3 install -U pywa

  • [flows] adding support for ChipsSelector component
  • [flows] flow_name instead of flow_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