Message Status#

class pywa.types.message_status.MessageStatus#

Represents the status of a message.

MessageStatus is a generic class, so when providing a factory parameter in callback handlers, you can specify the type of the factory to get autocomplete in the tracker attribute.

Here is an example:

>>> from pywa.types import CallbackData
>>> from dataclasses import dataclass
>>> @dataclass(frozen=True, slots=True)
>>> class UserData(CallbackData): # Subclass CallbackData
...     id: int
...     name: str
...     admin: bool
>>> from pywa import WhatsApp
>>> from pywa.types import Button, CallbackButton
>>> wa = WhatsApp(...)
>>> wa.send_message(
...     to='972987654321',
...     text='Hi user',
...     tracker=UserData(id=123, name='david', admin=True) # Here ^^^ we use the UserData class as the tracker
... )           # Here ^^^ we use the UserData class as the tracker data
>>> @wa.on_message_status(factory=UserData) # Use the factory parameter to convert the tracker data
... def on_status(_: WhatsApp, s: MessageStatus[UserData]): # For autocomplete
...    if s.tracker.admin: print(s.tracker.id) # Access the tracker data
Variables:
  • id – The ID of the message that the status is for.

  • metadata – The metadata of the message (to which phone number it was sent).

  • status (MessageStatusType) – The status of the message.

  • timestamp – The timestamp when the status was updated (in UTC).

  • from_user – The user who the message was sent to.

  • conversation (Conversation | None) – The conversation that the message was sent in (See Conversation).

  • pricing (Pricing | None) – The pricing of the message (Optional).

  • error (WhatsAppError | None) – The error that occurred (if status is MessageStatusType.FAILED).

  • tracker (_CallbackDataT | None) – The tracker that the message was sent with (e.g. wa.send_message(tracker=...)).

  • shared_data – Shared data between handlers.


class pywa.types.message_status.MessageStatusType#

Message status type.

Variables:
  • SENT – Indicates the message was successfully sent from our servers (WhatsApp UI equivalent: One checkmark).

  • DELIVERED – Indicates message was successfully delivered to the WhatsApp user’s device (WhatsApp UI equivalent: Two checkmarks).

  • READ – Indicates the message was displayed in an open chat thread in the WhatsApp user’s device (WhatsApp UI equivalent: Two blue checkmarks).

  • PLAYED – played β€” Indicates the first time a voice message is played to the WhatsApp user’s device (WhatsApp UI equivalent: Blue microphone).

  • FAILED – failed β€” Indicates failure to send or deliver the message to the WhatsApp user’s device (WhatsApp UI equivalent: Red error triangle).

class pywa.types.message_status.Conversation#

Conversations are 24-hour message threads between you and your customers. They are opened and charged when messages you send to customers are delivered.

Variables:
class pywa.types.message_status.ConversationCategory#

Conversation category.

Read more at developers.facebook.com.

Variables:
  • AUTHENTICATION – Indicates an authentication conversation.

  • AUTHENTICATION_INTERNATIONAL – Indicates an authentication-international conversation.

  • MARKETING – Indicates a marketing conversation.

  • MARKETING_LITE – Indicates a Marketing Messages Lite API conversation.

  • UTILITY – Indicates a utility conversation.

  • SERVICE – Indicates a service conversation.

  • REFERRAL_CONVERSION – Indicates a free entry point conversation.

  • UNKNOWN – The conversation category is unknown.

class pywa.types.message_status.Pricing#

Represents the pricing of a message.

Variables:
class pywa.types.message_status.PricingModel#

Pricing model.

Variables:
  • CBP – Indicates conversation-based pricing applies. Will only be set to this value if the webhook was sent before July 1, 2025.

  • PMP – Indicates per-message pricing applies.

class pywa.types.message_status.PricingType#

Pricing type.

Variables:
  • REGULAR – Indicates the message is billable.

  • FREE_CUSTOMER_SERVICE – Indicates the message is free because it was either a utility template message or non-template message sent within a customer service window.

  • FREE_ENTRY_POINT – Indicates the message is free because it is part of a free-entry point conversation.

class pywa.types.message_status.PricingCategory#

Pricing category.

Variables:
  • AUTHENTICATION – Indicates authentication rate applied.

  • AUTHENTICATION_INTERNATIONAL – Indicates authentication-international rate applied.

  • MARKETING – Indicates marketing rate applied.

  • MARKETING_LITE –

    Indicates a Marketing Messages Lite API pricing applied.

  • UTILITY – Indicates utility rate applied.

  • SERVICE – Indicates service rate applied.

  • REFERRAL_CONVERSION – Indicates a free entry point conversation.