Message Fields#
- class pywa.types.others.Reaction#
Represents a reaction to a message.
- Variables:
- class pywa.types.others.Location#
Represents a location.
- Variables:
- class pywa.types.others.Contact#
Represents a contact.
- Variables:
name (Name) β The name of the contact.
birthday (str | None) β The birthday of the contact (in
YYYY-MM-DDformat, optional).phones (Iterable[Phone]) β The phone numbers of the contact.
emails (Iterable[Email]) β The email addresses of the contact.
urls (Iterable[Url]) β The URLs of the contact.
addresses (Iterable[Address]) β The addresses of the contact.
org (Org | None) β The organization of the contact (optional).
- class Name(formatted_name: str, first_name: str | None = None, last_name: str | None = None, middle_name: str | None = None, suffix: str | None = None, prefix: str | None = None)#
Represents a contactβs name.
At least one of the optional parameters needs to be included along with the formatted_name parameter.
- Variables:
formatted_name (str) β The formatted name of the contact.
first_name (str | None) β The first name of the contact (optional).
last_name (str | None) β The last name of the contact (optional).
middle_name (str | None) β The middle name of the contact (optional).
suffix (str | None) β The suffix of the contact (optional).
prefix (str | None) β The prefix of the contact (optional).
- class Phone(phone: str | None = None, type: str | None = None, wa_id: str | None = None)#
Represents a contactβs phone number.
- class Email(email: str | None = None, type: str | None = None)#
Represents a contactβs email address.
- class Org(company: str | None = None, department: str | None = None, title: str | None = None)#
Represents a contactβs organization.
- class Address(street: str | None = None, city: str | None = None, state: str | None = None, zip: str | None = None, country: str | None = None, country_code: str | None = None, type: str | None = None)#
Represents a contactβs address.
- Variables:
street (str | None) β The street number and name of the address (optional).
city (str | None) β The city name of the address (optional).
state (str | None) β State abbreviation.
zip (str | None) β Zip code of the address (optional).
country (str | None) β Full country name.
country_code (str | None) β Two-letter country abbreviation (e.g. US, GB, IN. optional).
type (str | None) β The type of the address (Standard Values are WORK and HOME. optional).
- class pywa.types.others.Product#
Represents a product in an order.
- Variables:
- class pywa.types.others.Order#
Represents an order.
- Variables:
catalog_id (str) β The ID for the catalog the ordered item belongs to.
products (tuple[pywa.types.others.Product, ...]) β The ordered products.
text (str | None) β Text message from the user sent along with the order (optional).
- Properties:
total_price: Total price of the order.
- class pywa.types.others.Referral#
Represents a referral object in a message.
This object is included in the messages object when a customer clicks an ad that redirects to WhatsApp.
- Variables:
source_url (str | None) β The Meta URL that leads to the ad or post clicked by the customer.
source_type (str | None) β The type of the adβs source;
adorpost.source_id (str | None) β Meta ID for an ad or a post.
headline (str | None) β Headline used in the ad or post.
body (str | None) β Body for the ad or post.
media_type (str | None) β Media present in the ad or post;
imageorvideo.image_url (str | None) β URL of the image, when
media_typeis animage.video_url (str | None) β URL of the video, when
media_typeis avideo.thumbnail_url (str | None) β URL for the thumbnail, when media_type is a video.
ctwa_clid (str | None) β Click ID generated by Meta for ads that click to WhatsApp.
- class pywa.types.others.ReferredProduct#
Represents a product this message is referring to.
- class pywa.types.others.User#
Represents a WhatsApp user.
- Variables:
- block() bool#
Block the user.
Shortcut for
block_users()with the user wa_id.
- Returns:
True if the user was blocked
- Return type:
- Raises:
BlockUserError β If the user was not blocked
- unblock() bool#
Unblock the user.
Shortcut for
unblock_users()with the user wa_id.
- Returns:
True if the user was unblocked, False otherwise.
- Return type:
- class pywa.types.others.ReplyToMessage#
Represents a message that was replied to.
- Variables:
message_id (str) β The ID of the message that was replied to.
from_user_id (str) β The ID of the user who sent the message that was replied to.
referred_product (pywa.types.others.ReferredProduct | None) β Referred product describing the product the user is requesting information about.
- class pywa.types.others.Metadata#
Represents the metadata of a message.
- 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:
id (str) β Represents the ID of the conversation the given status notification belongs to.
category (pywa.types.message_status.ConversationCategory) β The category of the conversation.
expiration (datetime.datetime | None) β The expiration date (in UTC) of the conversation (Optional, only for sent updates).
- class pywa.types.message_status.ConversationCategory#
Conversation category.
- Variables:
AUTHENTICATION β The conversation is related to authentication.
MARKETING β The conversation is related to marketing.
MARKETING_LITE β The conversation is related to marketing lite.
UTILITY β The conversation is related to utility.
SERVICE β The conversation is related to service.
REFERRAL_CONVERSION β The conversation is related to referral conversion.
UNKNOWN β The conversation category is unknown.
- class pywa.types.message_status.Pricing#
Represents the pricing of a message.
- Variables:
billable (bool) β Indicates if the message is billable.
model (pywa.types.message_status.PricingModel) β The pricing model used for the message.
type (pywa.types.message_status.PricingType | None) β The pricing type of the message (Only available from webhook v24.0^).
category (pywa.types.message_status.PricingCategory) β The pricing category of the message.
- class pywa.types.message_status.PricingModel#
Pricing model.
- Variables:
CBP β Indicates conversation-based pricing applies.
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 an authentication template message.
AUTHENTICATION_INTERNATIONAL β Indicates an authentication template message sent to a WhatsApp user in a country or region that has authentication-international rates.
MARKETING β Indicates a marketing template message.
MARKETING_LITE β Indicates a marketing template message sent via MM Lite API.
UTILITY β Indicates a utility template message.
SERVICE β Indicates a non-template message.
REFERRAL_CONVERSION β Indicates the message is part of a free entry point conversation.