Flow Completion#
The FlowCompletion class represents an update that arrives when user completes a flow.
- class pywa.types.FlowCompletion#
A flow completion message. This update arrives when a user completes a flow.
Read more at developers.facebook.com.
- Variables:
id – The message ID (If you want to reply to the message, use
message_id_to_replyinstead).metadata – The metadata of the message (to which phone number it was sent).
type (MessageType) – The message type (Always
MessageType.INTERACTIVE).from_user – The user who sent the message.
timestamp – The timestamp when the message was sent (in UTC).
reply_to_message (ReplyToMessage | None) – The message to which this message is a reply to.
body (str) – The body of the message.
token (str | None) – The token of the flow. can be
Nonein some cases :|shared_data – Shared data between handlers.
- get_media(media_cls: Type[BaseUserMedia], key: str) BaseUserMedia#
Get the media object from the response.
Example
>>> from pywa import WhatsApp, types >>> wa = WhatsApp(...) >>> @wa.on_flow_completion() ... def on_flow_completion(_: WhatsApp, flow: types.FlowCompletion): ... img = flow.get_media(types.Image,key="image") ... img.download()
- Parameters:
media_cls – The media class to create the media object (e.g.
types.Image).key – The key of the media in the response.
- Returns:
The media object.
- Raises:
KeyError – If the key is not found in the response.