Others#
- class pywa.types.sent_message.SentMessage#
Represents a message that was sent to WhatsApp user.
- class pywa.types.others.BusinessProfile#
Represents a business profile.
- Variables:
about (str) β This text appears in the businessβs profile, beneath its profile image, phone number, and contact buttons.
address (str | None) β Address of the business. Character limit 256.
description (str | None) β Description of the business. Character limit 512.
email (str | None) β The contact email address (in valid email format) of the business. Character limit 128.
industry (pywa.types.others.Industry) β The industry of the business.
profile_picture_url (str | None) β URL of the profile picture that was uploaded to Meta.
websites (tuple[str, ...] | None) β The URLs associated with the business. For instance, a website, Facebook Page, or Instagram. There is a maximum of 2 websites with a maximum of 256 characters each.
- class pywa.types.others.BusinessPhoneNumber#
Represents a WhatsApp Business Phone Number.
See WhatsApp Business Phone Number.
- Variables:
id (str) β The ID of the phone number.
verified_name (str | None) β The name that appears in WhatsApp Manager and WhatsApp client chat thread headers, chat lists, and profile, if display criteria is met.
display_phone_number (str | None) β International format representation of the phone number.
conversational_automation (pywa.types.others.ConversationalAutomation | None) β Conversational Automation feature config for this phone number.
status (str | None) β The operating status of the phone number (eg. connected, rate limited, warned).
quality_rating (str | None) β The quality rating of the phone number.
quality_score (dict[str, str] | None) β Quality score of the phone.
webhook_configuration (dict[str, str] | None) β The webhook configuration of the phone number.
name_status (str | None) β The status of the name review.
new_name_status (str | None) β The status of the review of the new name requested.
code_verification_status (str | None) β Indicates the phone numberβs one-time password (OTP) verification status. Values can be NOT_VERIFIED, VERIFIED, or EXPIRED. Only phone numbers with a VERIFIED status can be registered. See Manage Phone Numbers and Certificates.
account_mode (str | None) β The account mode of the phone number. See Filtering Phone Numbers.
is_official_business_account (bool) β Indicates if phone number is associated with an Official Business Account.
is_pin_enabled (bool) β Returns True if a pin for two-step verification is enabled.
is_preverified_number (bool) β Returns true if the phone number was pre-verified
messaging_limit_tier (str | None) β Current messaging limit tier.
search_visibility (str | None) β The availability of the phone_number in the WhatsApp Business search.
platform_type (str | None) β Platform the business phone number is registered with. Values can be CLOUD_API, ON_PREMISE, or NOT_APPLICABLE. If NOT_APPLICABLE, the number is not registered with Cloud API or On-Premises API.
throughput (dict[str, str] | None) β The business phone numberβs Cloud API throughput level. See Phone Number Throughput.
eligibility_for_api_business_global_search (str | None) β Status of eligibility in the API Business Global Search.
certificate (str | None) β Certificate of the phone number
new_certificate (str | None) β Certificate of the new name that was requested
last_onboarded_time (str | None) β Indicates when the user added the business phone number to their WhatsApp Business Account (when the user completed the Embedded Signup flow).
- class pywa.types.others.ConversationalAutomation#
Represents a conversational automation.
See Conversational Automation.
- Variables:
id (str) β The ID of the WhatsApp Business Phone Number.
chat_opened_enabled (bool) β Whether the welcome message is enabled (if so, you can listen to the
ChatOpenedevent).ice_breakers (tuple[str] | None) β See Ice Breakers.
commands (tuple[pywa.types.others.Command] | None) β The commands.
- class pywa.types.others.QRCode#
Customers can scan a QR code from their phone to quickly begin a conversation with your business. The WhatsApp Business Management API allows you to create and access these QR codes and associated short links.
- Variables:
code (str) β The code of the QR code.
prefilled_message (str) β The message that will be prefilled when the user starts a conversation with the business using the QR code.
deep_link_url (str) β The deep link URL of the QR code.
qr_image_url (str | None) β The URL of the QR code image (return only when creating a QR code).
- class pywa.types.others.Command#
Represents a command in a conversational automation.
- class pywa.types.others.CommerceSettings#
Represents the WhatsApp commerce settings.
- class pywa.types.others.Industry#
Represents the industry of a business.
- Variables:
UNDEFINED β Undefined.
OTHER β Other.
AUTO β Automotive.
BEAUTY β Beauty.
APPAREL β Apparel.
EDU β Education.
ENTERTAIN β Entertainment.
EVENT_PLAN β Event planning.
FINANCE β Finance.
GROCERY β Grocery store.
GOVT β Government.
HOTEL β Hotel.
HEALTH β Health.
NONPROFIT β Nonprofit.
PROF_SERVICES β Professional services.
RETAIL β Retail.
TRAVEL β Travel.
RESTAURANT β Restaurant.
NOT_A_BIZ β Not a business.
- class pywa.types.others.WhatsAppBusinessAccount#
Represents a WhatsApp Business Account.
- class pywa.types.others.FacebookApplication#
Represents a Facebook Application.
- class pywa.Version#
Enum for the latest and minimum versions of the Graph API and WhatsApp Flows.
Use the constant to get the latest version. Example:
WhatsApp(..., api_version=Version.GRAPH_API)Using the latest version can break your code if the API changes. Use constants for stability.
Use the
minattribute to get the minimum version. Example: Version.GRAPH_API.min
- Variables:
GRAPH_API β (MIN_VERSION: str, LATEST_VERSION: str)
FLOW_JSON β (MIN_VERSION: str, LATEST_VERSION: str)
FLOW_DATA_API β (MIN_VERSION: str, LATEST_VERSION: str)
FLOW_MSG β (MIN_VERSION: str, LATEST_VERSION: str)
- class pywa.types.StopHandling#
Raise this exception to stop handling an update.
You can call
.stop_handling()on every update object to raise this exception.Example
>>> from pywa import WhatsApp >>> from pywa.types import Message >>> wa = WhatsApp(...)
>>> @wa.on_message() ... def callback(_: WhatsApp, msg: Message): ... msg.reply_text("Hello from PyWa!") ... msg.stop_handling() # or raise StopHandling
>>> @wa.on_message() ... def not_called(_: WhatsApp, msg: Message): ... msg.reply_text("This message will not be sent")
- class pywa.types.ContinueHandling#
Raise this exception to continue handling an update.
You can call
.continue_handling()on every update object to raise this exception.Example
>>> from pywa import WhatsApp >>> from pywa.types import Message >>> wa = WhatsApp(...)
>>> @wa.on_message() ... def callback(_: WhatsApp, msg: Message): ... msg.reply_text("Hello from PyWa!") ... msg.continue_handling() # or raise ContinueHandling
>>> @wa.on_message() ... def not_called(_: WhatsApp, msg: Message): ... msg.reply_text("This message will be sent")
- class pywa.types.ListenerTimeout#
The listener timed out
Example
try: wa.listen(to="123456", timeout=10) except ListenerTimeout as e: wa.send_message("123456", "Timeout")
- Variables:
timeout β The timeout that was set for the listener
- class pywa.types.ListenerCanceled#
The listener was canceled by a filter
Example
try: wa.listen( to="123456", filters=filters.message & filters.text, cancelers=filters.callback_button & filters.matches("cancel") ) except ListenerCanceled as e: print(e.update) # print the update that caused the listener to be canceled wa.send_message("123456", "You cancelled the listener by clicking the cancel button")
- Variables:
update β The update that caused the listener to be canceled
- class pywa.types.ListenerStopped#
The listener was stopped manually by wa.stop_listening(β¦)
Example
try: wa.listen("123456") except ListenerStopped as e: print(e.reason) # print the reason the listener was stopped wa.send_message("123456", "The listener was stopped")
- Variables:
reason β The reason the listener was stopped (set by wa.stop_listening(reason=ββ¦β))