💬 Updates#
Updates are the incoming events from WhatsApp Cloud API. They are sent to your webhook URL and constructed by the library to be easily and type-safely to handle.
In WhatsApp Cloud API, the updates called fields and need to be subscribed to in order to receive them to your webhook URL.
The currently supported fields by PyWa are:
messages(all user related updates: messages, callbacks and message status updates)message_template_status_update(template got approved, rejected, etc.)
Important
If you register your callback URL manually (not using PyWa), you need to subscribe to the fields you want to receive.
Go to your app dashboard, click on the Webhooks tab (Or the Configuration tab > Webhook fields).
Then, subscribe to the fields you want to receive.
Tip
If you do want to handle other types of updates (fields), you can use the RawUpdateHandler
(or the on_raw_update() decorator) to handle them.
The supported fields are automatically handled by PyWa and converted to the following types:
To handle updates see Handlers
User related updates:
Type |
Description |
|---|---|
A message sent by a user (text, media, order, location, etc.) |
|
A |
|
A |
|
A flow completed by a user |
|
A message status update (e.g. delivered, seen, etc.) |
|
A chat opened by a user |
Account related updates:
Type |
Description |
|---|---|
A template status update (e.g. approved, rejected, etc.) |
All updates have common methods and properties:
Property |
Description |
|---|---|
The update ID |
|
|
The raw update data |
The timestamp of the update |
|
Stop next handlers from handling the update |
|
Continue to the next handler |
All user-related-updates have common methods and properties:
Method / Property |
Description |
|---|---|
The phone id who sent the update |
|
The phone id who received the update |
|
The message id to reply to |
|
Reply to the update with a text message |
|
Reply to the update with an image message |
|
Reply to the update with a video message |
|
Reply to the update with an audio message |
|
Reply to the update with a document message |
|
Reply to the update with a location message |
|
Request a location from the user |
|
Reply to the update with a contact message |
|
Reply to the update with a sticker message |
|
Reply to the update with a template message |
|
Reply to the update with a catalog message |
|
Reply to the update with a product message |
|
Reply to the update with a list of product messages |
|
React to the update with a emoji |
|
Unreact to the update |
|
Mark the update as read |
- Message
- Callback Button
- Callback Selection
- Flow Completion
- Message Status
- Chat Opened
- Template Status
- Common methods
BaseUpdateBaseUserUpdateBaseUserUpdate.senderBaseUserUpdate.recipientBaseUserUpdate.message_id_to_replyBaseUserUpdate.reply_text()BaseUserUpdate.reply_image()BaseUserUpdate.reply_video()BaseUserUpdate.reply_audio()BaseUserUpdate.reply_document()BaseUserUpdate.reply_location()BaseUserUpdate.reply_location_request()BaseUserUpdate.reply_contact()BaseUserUpdate.reply_sticker()BaseUserUpdate.reply_template()BaseUserUpdate.reply_catalog()BaseUserUpdate.reply_product()BaseUserUpdate.reply_products()BaseUserUpdate.react()BaseUserUpdate.unreact()BaseUserUpdate.mark_as_read()