💬 Updates

💬 Updates#

In WhatsApp Cloud API, updates are sent to your webhook URL. PyWa currently supports the following fields:

  • messages (all user related updates)

  • message_template_status_update (template got approved, rejected, etc.)

Important

You must subscribe to those fields in your webhook settings. Otherwise, you will not receive any updates. To enable it, 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.

Subscribe to webhook fields

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:

User related updates:

Type

Description

Message

A message sent by a user (text, media, order, location, etc.)

CallbackButton

A callback button pressed by a user

CallbackSelection

A callback selection chosen by a user

MessageStatus

A message status update (e.g. delivered, seen, etc.)

Account related updates:

Type

Description

TemplateStatus

A template status update (e.g. approved, rejected, etc.)

All user-related-updates have common methods:

Method

Description

reply_text()

Reply to the update with a text message

reply_image()

Reply to the update with an image message

reply_video()

Reply to the update with a video message

reply_audio()

Reply to the update with an audio message

reply_document()

Reply to the update with a document message

reply_location()

Reply to the update with a location message

reply_contact()

Reply to the update with a contact message

reply_sticker()

Reply to the update with a sticker message

reply_template()

Reply to the update with a template message

reply_catalog()

Reply to the update with a catalog message

reply_product()

Reply to the update with a product message

reply_products()

Reply to the update with a list of product messages

react()

React to the update with a emoji

unreact()

Unreact to the update

mark_as_read()

Mark the update as read