wa_me.classes package¶
Submodules¶
wa_me.classes.enums module¶
- class wa_me.classes.enums.ComponentSubType(value)[source]¶
Bases:
Type
Component subtype.
- quick_reply = 'quick_reply'¶
- url = 'url'¶
- class wa_me.classes.enums.ComponentType(value)[source]¶
Bases:
Type
Component type.
- body = 'body'¶
- button = 'button'¶
- header = 'header'¶
- class wa_me.classes.enums.HeaderType(value)[source]¶
Bases:
Type
Message interactive header type.
- document = 'document'¶
- image = 'image'¶
- text = 'text'¶
- video = 'video'¶
- class wa_me.classes.enums.InfoType(value)[source]¶
Bases:
Type
Information type.
- home = 'HOME'¶
- work = 'WORK'¶
- class wa_me.classes.enums.InteractiveType(value)[source]¶
Bases:
Type
Message interactive type.
- button = 'button'¶
- button_reply = 'button_reply'¶
- list = 'list'¶
- list_reply = 'list_reply'¶
- product = 'product'¶
- product_list = 'product_list'¶
- class wa_me.classes.enums.MediaType(value)[source]¶
Bases:
Type
Referral supported media type.
- image = 'image'¶
- video = 'video'¶
- class wa_me.classes.enums.MessageType(value)[source]¶
Bases:
Type
Message type.
- audio = 'audio'¶
- button = 'button'¶
- contacts = 'contacts'¶
- document = 'document'¶
- image = 'image'¶
- interactive = 'interactive'¶
- location = 'location'¶
- order = 'order'¶
- reaction = 'reaction'¶
- sticker = 'sticker'¶
- system = 'system'¶
- template = 'template'¶
- text = 'text'¶
- unknown = 'unknown'¶
- unsupported = 'unsupported'¶
- video = 'video'¶
- class wa_me.classes.enums.OriginType(value)[source]¶
Bases:
Type
Origin type.
Note
Indicates where a conversation has started.
business_initiated: Indicates that the conversation started by a
business sending the first message to a customer. This applies any time it has been more than 24 hours since the last customer message. - customer_initiated: Indicates that the conversation started by a business replying to a customer message. This applies only when the business reply is within 24 hours of the last customer message. - referral_conversion: Indicates that the conversation originated from a free entry point. These conversations are always customer-initiated.
- business_initiated = 'business_initiated'¶
- referral_conversion = 'referral_conversion'¶
- user_initiated = 'user_initiated'¶
- class wa_me.classes.enums.ParameterType(value)[source]¶
Bases:
Type
Component parameter type.
- currency = 'currency'¶
- date_time = 'date_time'¶
- document = 'document'¶
- image = 'image'¶
- text = 'text'¶
- video = 'video'¶
- class wa_me.classes.enums.PhoneType(value)[source]¶
Bases:
Type
Phone information type.
- cell = 'CELL'¶
- home = 'HOME'¶
- iphone = 'IPHONE'¶
- main = 'MAIN'¶
- work = 'WORK'¶
- class wa_me.classes.enums.SourceType(value)[source]¶
Bases:
Type
Referral source type.
- ad = 'ad'¶
- post = 'post'¶
- class wa_me.classes.enums.StatusType(value)[source]¶
Bases:
Type
Status type.
- deleted = 'deleted'¶
- delivered = 'delivered'¶
- failed = 'failed'¶
- read = 'read'¶
- sent = 'sent'¶
wa_me.classes.events module¶
- class wa_me.classes.events.Address(city: Optional[str] = None, country_code: Optional[str] = None, country: Optional[str] = None, state: Optional[str] = None, street: Optional[str] = None, type: Optional[InfoType] = None, zip: Optional[str] = None)[source]¶
Bases:
object
Address object.
Parameters¶
- city: Optional[
str
] The name of the city.
- country_code: Optional[
str
] The two-letter country abbreviation.
- country: Optional[
str
] The full name of the country.
- state: Optional[
str
] The abbreviation name of the state.
- street: Optional[
str
] Steet number and name.
- type: Optional[
InfoType
] Address type.
- zip: Optional[
str
] The ZIP code.
- city: Optional[str] = None¶
- country: Optional[str] = None¶
- country_code: Optional[str] = None¶
- state: Optional[str] = None¶
- street: Optional[str] = None¶
- zip: Optional[str] = None¶
- city: Optional[
- class wa_me.classes.events.Audio(id: str, mime_type: str)[source]¶
Bases:
Media
Audio object.
- id: str¶
- mime_type: str¶
- class wa_me.classes.events.Button(payload: str, text: str)[source]¶
Bases:
object
Button object.
Parameters¶
- payload:
str
The payload for a button set up by the business that a customer clicked as part of an interactive message.
- text:
str
Button text.
- payload: str¶
- text: str¶
- payload:
- class wa_me.classes.events.ButtonReply(id: str, title: str)[source]¶
Bases:
Reply
Reply object for “button_reply”.
- id: str¶
- title: str¶
- class wa_me.classes.events.Change(field: Literal['messages'], value: Value)[source]¶
Bases:
object
Change object.
Webhooks are triggered when a customer performs an action or the status for a message a business sends a customer changes.
Parameters¶
- field:
str
The type of notification. The only option for this API is “messages”.
- value:
Value
The details for the changes.
- field: Literal['messages']¶
- field:
- class wa_me.classes.events.Contact(name: Name, addresses: Optional[List[Address]] = None, birthday: Optional[str] = None, emails: Optional[List[Email]] = None, org: Optional[Org] = None, phones: Optional[List[Phone]] = None, urls: Optional[List[URL]] = None)[source]¶
Bases:
object
Contact object.
Parameters¶
- name:
Name
Specifies the name object.
- addresses: Optional[List[
Address
]] Specifies an array of address objects.
- birthday: Optional[
str
] A YYYY-MM-DD formatted string.
- emails: Optional[List[
Email
]] Specifies an array of email objects.
- org: Optional[
Org
] Specifies the org object.
- phones: Optional[List[
Phone
]] Specifies an array of phone objects.
- urls: Optional[List[
URL
]] Specifies an array of url objects.
- birthday: Optional[str] = None¶
- name:
- class wa_me.classes.events.Context(id: str, forwarded: Optional[bool] = None, frequently_forwarded: Optional[bool] = None, referred_product: Optional[ReferredProduct] = None, sender: Optional[str] = None)[source]¶
Bases:
object
Context object.
Parameters¶
- id:
str
The message ID for the sent message for an inbound reply.
- forwarded: Optional[
bool
] Set to true if the message received by the business has been forwarded.
- frequently_forwarded: Optional[
bool
] Set to true if the message received by the business has been forwarded more than 5 times.
- referred_product: Optional[
ReferredProduct
] The product the user is requesting information about.
Note
Required for Product Enquiry Messages.
- sender: Optional[
str
] The WhatsApp ID for the customer who replied to an inbound message.
- forwarded: Optional[bool] = None¶
- frequently_forwarded: Optional[bool] = None¶
- id: str¶
- referred_product: Optional[ReferredProduct] = None¶
- sender: Optional[str] = None¶
- id:
- class wa_me.classes.events.Conversation(id: str, origin: Origin, expiration_timestamp: Optional[str] = None)[source]¶
Bases:
object
Conversation object.
Parameters¶
- id:
str
Represents the ID of the conversation the given status notification belongs to.
- origin:
Origin
Indicates who initiated the conversation.
- expiration_timestamp: Optional[
int
] Date when the conversation expires.
- expiration_timestamp: Optional[str] = None¶
- id: str¶
- id:
- class wa_me.classes.events.Customer(profile: Profile, wa_id: str)[source]¶
Bases:
object
Customer object.
Parameters¶
- profile:
Profile
An object containing customer profile information
- wa_id:
str
The customer’s WhatsApp ID. A business can respond to a message using this ID.
- wa_id: str¶
- profile:
- class wa_me.classes.events.Document(id: str, mime_type: str, caption: Optional[str] = None, filename: Optional[str] = None, sha256: Optional[str] = None)[source]¶
Bases:
MediaWithCaption
Document object.
Parameters¶
- filename:
str
Name for the file on the sender’s device
- sha256:
str
Hash for the file.
- filename: Optional[str] = None¶
- sha256: Optional[str] = None¶
- filename:
- class wa_me.classes.events.Email(email: Optional[str] = None, type: Optional[InfoType] = None)[source]¶
Bases:
object
Email object.
Parameters¶
- email: Optional[
str
] Email address.
- type: Optional[
InfoType
] Email type.
- email: Optional[str] = None¶
- email: Optional[
- class wa_me.classes.events.Entry(id: str, changes: List[Change])[source]¶
Bases:
object
Entry object.
Webhooks are triggered when a customer performs an action or the status for a message a business sends a customer changes.
Parameters¶
- id:
str
The WhatsApp Business Account ID for the business that is subscribed to the webhook.
- changes: List[
Change
] A list of change object that triggered the webhook.
- id: str¶
- id:
- class wa_me.classes.events.Error(code: Optional[int] = None, details: Optional[str] = None, title: Optional[str] = None)[source]¶
Bases:
object
Error object.
Parameters¶
- code:
int
Error code.
- details:
str
Error title.
- title:
str
Error details.
- code: Optional[int] = None¶
- details: Optional[str] = None¶
- title: Optional[str] = None¶
- code:
- class wa_me.classes.events.Event(object: Literal['whatsapp_business_account'], entry: List[Entry])[source]¶
Bases:
object
Notification payload object.
Webhooks are triggered when a customer performs an action or the status for a message a business sends a customer changes.
Parameters¶
- object:
str
The specific webhook a business is subscribed to. The webhook is “whatsapp_business_account”.
- entry: List[
Entry
] A list of entry object.
- object: Literal['whatsapp_business_account']¶
- object:
- class wa_me.classes.events.Identity(acknowledged: bool, created_timestamp: str, hash: str)[source]¶
Bases:
object
Identity object.
Parameters¶
- acknowledged:
bool
State of acknowledgment for the messages system.
- created_timestamp:
int
The time when the WhatsApp Business Management API detected the customer may have changed their profile information.
- hash:
str
The ID for the messages system.
- acknowledged: bool¶
- created_timestamp: str¶
- hash: str¶
- acknowledged:
- class wa_me.classes.events.Image(id: str, mime_type: str, caption: Optional[str] = None, sha256: Optional[str] = None)[source]¶
Bases:
MediaWithCaption
Image object.
Parameters¶
- sha256:
str
Hash for the image.
- sha256: Optional[str] = None¶
- sha256:
- class wa_me.classes.events.Interactive(type: InteractiveType, button_reply: Optional[ButtonReply] = None, list_reply: Optional[ListReply] = None)[source]¶
Bases:
object
Interactive object.
Parameters¶
- type:
InteractiveType
The type of the interactive message.
- button_reply: Optional[
ButtonReply
] Sent when a customer clicks a button.
- list_reply: Optional[
ListReply
] Sent when a customer selects an item from a list.
- button_reply: Optional[ButtonReply] = None¶
- type: InteractiveType¶
- type:
- class wa_me.classes.events.ListReply(id: str, title: str, description: Optional[str] = None)[source]¶
Bases:
Reply
Reply object for “list_reply”.
Parameters¶
- description: Optional[
str
] Description of the selected row (only for list items).
- description: Optional[str] = None¶
- description: Optional[
- class wa_me.classes.events.Location(latitude: float, longitude: float, address: Optional[str] = None, name: Optional[str] = None)[source]¶
Bases:
object
Location object.
Parameters¶
- longitude:
float
The longitude of the location.
- latitude:
float
The latitude of the location.
- address: Optional[
str
] The address of the location.
- name: Optional[
str
] The name of the location.
- address: Optional[str] = None¶
- latitude: float¶
- longitude: float¶
- name: Optional[str] = None¶
- longitude:
- class wa_me.classes.events.Media(id: str, mime_type: str)[source]¶
Bases:
object
Media with caption object.
Parameters¶
- id:
str
The media object ID.
- mime_type:
str
Mime type of the media file.
- id: str¶
- mime_type: str¶
- id:
- class wa_me.classes.events.MediaWithCaption(id: str, mime_type: str, caption: Optional[str] = None)[source]¶
Bases:
Media
Media object.
Parameters¶
- caption: Optional[
str
] Caption for the media.
- caption: Optional[
- class wa_me.classes.events.Message(id: str, sender: str, timestamp: str, type: MessageType, audio: Optional[Audio] = None, button: Optional[Button] = None, contacts: Optional[List[Contact]] = None, context: Optional[Context] = None, document: Optional[Document] = None, errors: Optional[List[Error]] = None, identity: Optional[Identity] = None, image: Optional[Image] = None, interactive: Optional[Interactive] = None, location: Optional[Location] = None, order: Optional[Order] = None, reaction: Optional[Reaction] = None, referral: Optional[Referral] = None, sticker: Optional[Sticker] = None, system: Optional[System] = None, text: Optional[Text] = None, video: Optional[Video] = None)[source]¶
Bases:
object
Message object.
Parameters¶
- id:
str
The ID for the message that was received by the business.
- sender:
str
The customer’s phone number who sent the message to the business
- timestamp:
int
The time when the customer sent the message to the business.
- type:
MessageType
The type of message that has been received by the business that has subscribed to Webhooks.
- audio: Optional[
Audio
] When the messages type is set to audio, including voice messages, this object is included in the messages object.
- button: Optional[
Button
] When the messages type field is set to button, this object is included in the messages object.
- contacts: Optional[List[
Contact
]] When messages type is set to contacts, this object is included in the messages object.
- context: Optional[
Context
] The context for a message that was forwarded or in an inbound reply from the customer.
- document: Optional[
Document
] When messages type is set to document, this object is included in the messages object.
- errors: Optional[List[
Error
]] The message that a business received from a customer is not a supported type.
- identity: Optional[
Identity
] A webhook is triggered when a customer’s phone number or profile information has been updated.
- image: Optional[
Image
] When messages type is set to image, this object is included in the messages object.
- interactive: Optional[
Interactive
] When a customer selected a button or list reply, this object is included in the messages object.
- location: Optional[
Location
] When messages type is set to location, this object is included in the messages object.
- order: Optional[
Order
] Included in the messages object when a customer has placed an order.
- reaction: Optional[
Reaction
] When messages type is set to reaction, this object is included in the messages object.
- referral: Optional[
Referral
] A customer clicked an ad that redirects them to WhatsApp, this object is included in the messages object.
- sticker: Optional[
Sticker
] When messages type is set to sticker, this object is included in the messages object.
- system: Optional[
System
] When messages type is set to system, a customer has updated their phone number or profile information, this object is included in the messages object.
- text: Optional[
Text
] When messages type is set to text, the body of text is included in the messages object.
- video: Optional[
Video
] When messages type is set to video, this object is included in messages object.
- id: str¶
- interactive: Optional[Interactive] = None¶
- sender: str¶
- timestamp: str¶
- type: MessageType¶
- id:
- class wa_me.classes.events.Metadata(display_phone_number: str, phone_number_id: str)[source]¶
Bases:
object
Metadata for the business that is subscribed to the webhook.
Parameters¶
- display_phone_number:
str
The phone number that is displayed for a business.
- phone_number_id:
str
ID for the phone number. A business can respond to a message using this ID.
- display_phone_number: str¶
- phone_number_id: str¶
- display_phone_number:
- class wa_me.classes.events.Name(formatted_name: str, first_name: Optional[str] = None, last_name: Optional[str] = None, middle_name: Optional[str] = None, prefix: Optional[str] = None, suffix: Optional[str] = None)[source]¶
Bases:
object
Name object.
Parameters¶
- formatted_name:
str
Full name, as it normally appears.
- first_name: Optional[
str
] First name.
- last_name: Optional[
str
] Last name.
- middle_name: Optional[
str
] Middle name.
- prefix: Optional[
str
] Name prefix.
- suffix: Optional[
str
] Name suffix.
- first_name: Optional[str] = None¶
- formatted_name: str¶
- last_name: Optional[str] = None¶
- middle_name: Optional[str] = None¶
- prefix: Optional[str] = None¶
- suffix: Optional[str] = None¶
- formatted_name:
- class wa_me.classes.events.Order(catalog_id: str, text: str, product_items: Optional[List[Product]] = None)[source]¶
Bases:
object
Order object.
Parameters¶
- catalog_id:
str
ID for the catalog the ordered item belongs to.
- text:
str
Text message from the user sent along with the order.
- product_items: Optional[List[
Product
]] A list of product item objects.
- catalog_id: str¶
- text: str¶
- catalog_id:
- class wa_me.classes.events.Org(company: Optional[str] = None, department: Optional[str] = None, title: Optional[str] = None)[source]¶
Bases:
object
Org object.
Parameters¶
- company: Optional[
str
] Name of the contact’s company.
- department: Optional[
str
] Name of the contact’s department.
- title: Optional[
str
] The contact’s business title.
- company: Optional[str] = None¶
- department: Optional[str] = None¶
- title: Optional[str] = None¶
- company: Optional[
- class wa_me.classes.events.Origin(type: OriginType)[source]¶
Bases:
object
Origin object.
Parameters¶
- type:
OriginType
Indicates where a conversation has started. This can also be referred to as a conversation entry point.
- type: OriginType¶
- type:
- class wa_me.classes.events.Phone(phone: Optional[str] = None, type: Optional[PhoneType] = None, wa_id: Optional[str] = None)[source]¶
Bases:
object
Phone object.
Parameters¶
- phone: Optional[
str
] Contact phone number.
- type: Optional[
PhoneType
] Phone type.
- wa_id: Optional[
str
] WhatsApp ID.
- phone: Optional[str] = None¶
- wa_id: Optional[str] = None¶
- phone: Optional[
- class wa_me.classes.events.Pricing(category: Optional[OriginType] = None, pricing_model: Optional[PricingType] = None)[source]¶
Bases:
object
Pricing object.
Parameters¶
- category: Optional[
OriginType
] Indicates the conversation pricing category.
- pricing_model: Optional[
PricingType
] Type of pricing model used by the business.
- category: Optional[OriginType] = None¶
- pricing_model: Optional[PricingType] = None¶
- category: Optional[
- class wa_me.classes.events.Product(currency: str, item_price: float, product_retailer_id: str, quantity: int)[source]¶
Bases:
object
Product object.
Parameters¶
- currency:
str
Price currency.
- item_price:
float
Price of each item.
- product_retailer_id:
str
Unique identifier of the product in a catalog.
- quantity:
int
Number of items.
- currency: str¶
- item_price: float¶
- product_retailer_id: str¶
- quantity: int¶
- currency:
- class wa_me.classes.events.Profile(name: Optional[str] = None)[source]¶
Bases:
object
Metadata for the business that is subscribed to the webhook.
Parameters¶
- name:
str
The customer’s name.
- name: Optional[str] = None¶
- name:
- class wa_me.classes.events.Reaction(message_id: str, emoji: Optional[str] = None)[source]¶
Bases:
object
Document object.
Parameters¶
- emoji:
str
The emoji used for the reaction.
- message_id:
str
The WhatsApp Business Account ID of the message received that contained the reaction.
- emoji: Optional[str] = None¶
- message_id: str¶
- emoji:
- class wa_me.classes.events.Referral(body: str, headline: str, media_type: MediaType, source_id: str, source_type: SourceType, source_url: str, image_url: Optional[str] = None, thumbnail_url: Optional[str] = None, video_url: Optional[str] = None)[source]¶
Bases:
object
Referral object.
Parameters¶
- body:
str
Body for the ad or post.
- headline:
str
Headline used in the ad or post.
- image_url: Optional[
str
] URL of the image, when media_type is an image.
- media_type:
MediaType
Media present in the ad or post.
- source_id:
str
Meta ID for an ad or a post.
- source_type:
SourceType
The type of the ad’s source.
- source_url:
str
A customer clicked an ad that redirects them to WhatsApp, this object is included in the messages object.
- thumbnail_url: Optional[
str
] URL for the thumbnail, when media_type is a “video”.
- video_url: Optional[
str
] URL of the video, when media_type is a “video”.
- body: str¶
- headline: str¶
- image_url: Optional[str] = None¶
- source_id: str¶
- source_type: SourceType¶
- source_url: str¶
- thumbnail_url: Optional[str] = None¶
- video_url: Optional[str] = None¶
- body:
- class wa_me.classes.events.ReferredProduct(catalog_id: str, product_retailer_id: str)[source]¶
Bases:
object
ReferredProduct object.
Parameters¶
- catalog_id:
str
Unique ID of the Meta catalog linked to the WhatsApp Business Account.
- product_retailer_id:
str
Unique ID of the product in a catalog.
- catalog_id: str¶
- product_retailer_id: str¶
- catalog_id:
- class wa_me.classes.events.Reply(id: str, title: str)[source]¶
Bases:
object
Reply object for “list_reply”.
Parameters¶
- id:
str
Unique ID of a selected button or list item.
- title:
str
Title of a selected button or list item.
- id: str¶
- title: str¶
- id:
- class wa_me.classes.events.Status(id: str, recipient_id: str, status: StatusType, timestamp: str, conversation: Optional[Conversation] = None, errors: Optional[List[Error]] = None, pricing: Optional[Pricing] = None)[source]¶
Bases:
object
Status object.
- id:
str
The ID for the message that the business that is subscribed to the webhooks sent to a customer.
- recipient_id:
str
The WhatsApp ID for the customer that the business, that is subscribed to the webhooks, sent to the customer.
- status:
StatusType
A webhook is triggered when a message received by a business has been status updated.
- timestamp:
int
Date for the status message.
- conversation: Optional[
Conversation
] Information about the conversation.
- errors: Optional[List[
Error
]] A list of error objects.
- pricing: Optional[
Pricing
] An object containing billing information.
- conversation: Optional[Conversation] = None¶
- id: str¶
- recipient_id: str¶
- status: StatusType¶
- timestamp: str¶
- id:
- class wa_me.classes.events.Sticker(id: str, mime_type: str, animated: bool, sha256: Optional[str] = None)[source]¶
Bases:
Media
Image object.
Parameters¶
- animated:
bool
Set to true if the sticker is animated; false otherwise.
- sha256:
str
Hash for the sticker.
- animated: bool¶
- sha256: Optional[str] = None¶
- animated:
- class wa_me.classes.events.System(body: str, customer: str, identity: str, type: SystemUpdateType, new_wa_id: Optional[str] = None, wa_id: Optional[str] = None)[source]¶
Bases:
object
System object.
Parameters¶
- body:
str
Describes the change to the customer’s identity or phone number.
- customer:
str
The WhatsApp ID for the customer prior to the update.
- identity:
str
Hash for the identity fetched from server.
- type:
SystemUpdateType
Type of system update.
- new_wa_id: Optional[
str
] New WhatsApp ID for the customer when their phone number is updated.
- wa_id: Optional[
str
] New WhatsApp ID for the customer when their phone number is updated.
- body: str¶
- customer: str¶
- identity: str¶
- new_wa_id: Optional[str] = None¶
- type: SystemUpdateType¶
- wa_id: Optional[str] = None¶
- body:
- class wa_me.classes.events.Text(body: str)[source]¶
Bases:
object
Text object.
Parameters¶
- body:
str
The text of the message.
- body: str¶
- body:
- class wa_me.classes.events.URL(type: Optional[InfoType] = None, url: Optional[str] = None)[source]¶
Bases:
object
URL object.
Parameters¶
- type: Optional[
InfoType
] URL type.
- url: Optional[
str
] The URL.
- url: Optional[str] = None¶
- type: Optional[
- class wa_me.classes.events.Value(messaging_product: Literal['whatsapp'], metadata: Metadata, contacts: Optional[List[Customer]] = None, errors: Optional[List[Error]] = None, messages: Optional[List[Message]] = None, statuses: Optional[List[Status]] = None)[source]¶
Bases:
object
The value object contains details for the change that triggered the webhook.
Parameters¶
- messaging_product:
str
The value is always “whatsapp”.
- metadata:
Metadata
Metadata for the business.
- contacts: Optional[List[
Customer
]] A list of contacts objects with information for the customer who sent a message to the business.
- errors: Optional[List[
Error
]] A list of error objects with information received when a message failed.
- messages: Optional[List[
Message
]] Information about a message received by the business
- statuses: Optional[List[
Status
]] Status for a message that was sent by the business.
- messaging_product: Literal['whatsapp']¶
- messaging_product:
- class wa_me.classes.events.Video(id: str, mime_type: str, caption: Optional[str] = None, filename: Optional[str] = None, sha256: Optional[str] = None)[source]¶
Bases:
MediaWithCaption
Document object.
Parameters¶
- filename:
str
Name for the video on the sender’s device
- sha256:
str
Hash for the video.
- filename: Optional[str] = None¶
- sha256: Optional[str] = None¶
- filename:
wa_me.classes.messages module¶
- class wa_me.classes.messages.Action(button: Optional[str] = None, buttons: Optional[List[Button]] = None, catalog_id: Optional[str] = None, product_retailer_id: Optional[str] = None, sections: Optional[List[Section]] = None)[source]¶
Bases:
object
Action object.
Parameters¶
- button: Optional[
str
] The button content. Min: 1 char. Max: 20 chars.
Note
Required for
InteractiveType.list
. It cannot be an empty string and must be unique within the message. Does not allow emojis or markdown.- buttons: Optional[List[
Button
]] A list of button object. Min: 1 item. Max: 3 items.
Note
Required for
InteractiveType.button_reply
.- catalog_id: Optional[
str
] Unique identifier of the Facebook catalog linked to your WhatsApp Business Account.
Note
Required for
InteractiveType.product
andInteractiveType.product_list
.- product_retailer_id: Optional[
str
] The unique identifier of the product in the catalog.
Note
Required for
InteractiveType.product
andInteractiveType.product_list
.- sections: Optional[List[
Section
]] A list of section object. Min: 1 item. Max: 10 items.
Note
Required for
InteractiveType.list
andInteractiveType.product_list
.
- button: Optional[str] = None¶
- catalog_id: Optional[str] = None¶
- product_retailer_id: Optional[str] = None¶
- button: Optional[
- class wa_me.classes.messages.Address(city: Optional[str] = None, country_code: Optional[str] = None, country: Optional[str] = None, state: Optional[str] = None, street: Optional[str] = None, type: Optional[InfoType] = None, zip: Optional[str] = None)[source]¶
Bases:
object
Address object.
Parameters¶
- city: Optional[
str
] The name of the city.
- country_code: Optional[
str
] The two-letter country abbreviation.
- country: Optional[
str
] The full name of the country.
- state: Optional[
str
] The abbreviation name of the state.
- street: Optional[
str
] Steet number and name.
- type: Optional[
InfoType
] Address type.
- zip: Optional[
str
] The ZIP code.
- city: Optional[str] = None¶
- country: Optional[str] = None¶
- country_code: Optional[str] = None¶
- state: Optional[str] = None¶
- street: Optional[str] = None¶
- zip: Optional[str] = None¶
- city: Optional[
- class wa_me.classes.messages.Audio(id: Optional[str] = None, link: Optional[str] = None)[source]¶
Bases:
Media
Audio object.
- class wa_me.classes.messages.Body(text: str)[source]¶
Bases:
object
Body object.
Parameters¶
- text:
str
The text field for the body object, supports Emojis and markdown. Max: 1024 chars.
- text: str¶
- text:
- class wa_me.classes.messages.Button(reply: Reply, type: Literal['reply'] = 'reply')[source]¶
Bases:
object
Button object.
Parameters¶
- id: :class`str`:
Unique identifier button. This ID is returned in the webhook when the button is clicked by the user. Min: 1 char. Max: 256 chars.
- title: :class`str`:
Button title.
Note
It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not.
- type: :class`str`:
Button type. The only supported option is “reply”. Min: 1 char. Max: 20 chars.
- reply: Reply¶
- type: Literal['reply'] = 'reply'¶
- class wa_me.classes.messages.Component(type: ComponentType, sub_type: Optional[ComponentSubType] = None, parameters: Optional[List[Parameter]] = None, index: Optional[str] = None)[source]¶
Bases:
object
Component object.
Parameters¶
- type:
ComponentType
Describes the component type.
- sub_type: Optional[
ComponentSubType
] Type of button to create.
Note
Required when type is “button”. Not used for the other types.
- parameters: Optional[List[
Parameter
]] List of parameter objects with the content of the message.
Note
Required when type is “button”. Not used for the other types.
- index: Optional[
str
] Position index of the button.
Note
Required when type is “button”. Not used for the other types. You can have up to 3 buttons using index values of 0 to 2.
- index: Optional[str] = None¶
- sub_type: Optional[ComponentSubType] = None¶
- type: ComponentType¶
- type:
- class wa_me.classes.messages.Contact(name: Name, addresses: Optional[List[Address]] = None, birthday: Optional[str] = None, emails: Optional[List[Email]] = None, org: Optional[Org] = None, phones: Optional[List[Phone]] = None, urls: Optional[List[URL]] = None)[source]¶
Bases:
object
Contact object.
Parameters¶
- name:
Name
Specifies the name object.
- addresses: Optional[List[
Address
]] Specifies an array of address objects.
- birthday: Optional[
str
] A YYYY-MM-DD formatted string.
- emails: Optional[List[
Email
]] Specifies an array of email objects.
- org: Optional[
Org
] Specifies the org object.
- phones: Optional[List[
Phone
]] Specifies an array of phone objects.
- urls: Optional[List[
URL
]] Specifies an array of url objects.
- birthday: Optional[str] = None¶
- name:
- class wa_me.classes.messages.Context(message_id: str)[source]¶
Bases:
object
Context object.
Parameters¶
- message_id:
str
The WhatsApp Business Account ID for the message you want to reply.
- message_id: str¶
- message_id:
- class wa_me.classes.messages.Currency(amount_1000: int, code: str, fallback_value: str)[source]¶
Bases:
object
Currency object.
Parameters¶
- amount_1000:
int
Amount multiplied by 1000.
- code:
str
Currency code as defined in ISO 4217.
- fallback_value:
str
Default text if localization fails.
- amount_1000: int¶
- code: str¶
- fallback_value: str¶
- amount_1000:
- class wa_me.classes.messages.DateTime(fallback_value: str)[source]¶
Bases:
object
DateTime object.
Parameters¶
- fallback_value:
str
Default text.
- fallback_value: str¶
- fallback_value:
- class wa_me.classes.messages.Document(id: Optional[str] = None, link: Optional[str] = None, caption: Optional[str] = None, filename: Optional[str] = None)[source]¶
Bases:
MediaWithCaption
Document object.
Parameters¶
- filename: Optional[
str
] Describes the filename for the specific document.
- filename: Optional[str] = None¶
- filename: Optional[
- class wa_me.classes.messages.Email(email: Optional[str] = None, type: Optional[InfoType] = None)[source]¶
Bases:
object
Email object.
Parameters¶
- email: Optional[
str
] Email address.
- type: Optional[
InfoType
] Email type.
- email: Optional[str] = None¶
- email: Optional[
Bases:
object
Footer object.
Parameters¶
- text:
str
The text field for the footer object, supports Emojis and markdown. Max: 60 chars.
- text:
- class wa_me.classes.messages.Header(type: HeaderType, document: Optional[Document] = None, image: Optional[Image] = None, text: Optional[Text] = None, video: Optional[Video] = None)[source]¶
Bases:
object
Header object.
Parameters¶
- type:
HeaderType
The header type.
- document: Optional[
Document
] A media object containing a document. Required if type is set to
HeaderType.document
- image: Optional[
Image
] A media object containing a image. Required if type is set to
HeaderType.image
- text: Optional[
Text
] A media object containing a text. Required if type is set to
HeaderType.text
- video: Optional[
Video
] A media object containing a video. Required if type is set to
HeaderType.video
- type: HeaderType¶
- type:
- class wa_me.classes.messages.Image(id: Optional[str] = None, link: Optional[str] = None, caption: Optional[str] = None)[source]¶
Bases:
MediaWithCaption
Image object.
- class wa_me.classes.messages.Interactive(type: InteractiveType, action: Action, body: Optional[Body] = None, footer: Optional[Footer] = None, header: Optional[Header] = None)[source]¶
Bases:
object
Interactive object.
Parameters¶
- type:
InteractiveType
The type of interactive message.
- action:
Action
The action you want the user to perform after reading the message.
- body: Optional[
Body
] The body of the message.
Note
Optional for type
InteractiveType.product
. Required for all other message types.- footer: Optional[
Footer
] The footer of the message.
- header: Optional[
Header
] The header content displayed on top of the message.
Note
Required for type
InteractiveType.product_list
. Optional for other types. You cannot set a header if your interactive object is typeInteractiveType.product
.
- type: InteractiveType¶
- type:
- class wa_me.classes.messages.Language(code: str, policy: Literal['deterministic'] = 'deterministic')[source]¶
Bases:
object
Language object.
Parameters¶
- code:
str
The code of the language or locale to use.
Note
This field accepts both language (for example, “en”) and language_locale (for example, “en_US”) formats.
- policy:
str
Language policy option.
Note
Default (and only supported value): deterministic
- code: str¶
- policy: Literal['deterministic'] = 'deterministic'¶
- code:
- class wa_me.classes.messages.Location(latitude: float, longitude: float, address: Optional[str] = None, name: Optional[str] = None)[source]¶
Bases:
object
Location object.
Parameters¶
- longitude:
float
The longitude of the location.
- latitude:
float
The latitude of the location.
- address: Optional[
str
] The address of the location. This field is only displayed if name is present.
- name: Optional[
str
] The name of the location.
- address: Optional[str] = None¶
- latitude: float¶
- longitude: float¶
- name: Optional[str] = None¶
- longitude:
- class wa_me.classes.messages.Media(id: Optional[str] = None, link: Optional[str] = None)[source]¶
Bases:
object
Media object.
Parameters¶
- id: Optional[
str
] The media object ID. Required when you are not using a link.
- link: Optional[
str
] The protocol and URL of the media to be sent. Required when you are not using an uploaded media ID.
- id: Optional[str] = None¶
- link: Optional[str] = None¶
- id: Optional[
- class wa_me.classes.messages.MediaWithCaption(id: Optional[str] = None, link: Optional[str] = None, caption: Optional[str] = None)[source]¶
Bases:
Media
Media with caption object.
Parameters¶
- caption: Optional[
str
] Describes the specified media. Max: 4096 chars.
- caption: Optional[
- class wa_me.classes.messages.Message(to: str, messaging_product: Literal['whatsapp'] = 'whatsapp', recipient_type: Literal['individual'] = 'individual', context: Optional[Context] = None, type: Optional[MessageType] = None, audio: Optional[Audio] = None, contacts: Optional[List[Contact]] = None, document: Optional[Document] = None, image: Optional[Image] = None, interactive: Optional[Interactive] = None, location: Optional[Location] = None, reaction: Optional[Reaction] = None, sticker: Optional[Sticker] = None, template: Optional[Template] = None, text: Optional[Text] = None, video: Optional[Video] = None, message_id: Optional[str] = None, status: Optional[StatusType] = None)[source]¶
Bases:
object
Message object to send a message.
Parameters¶
- to:
str
WhatsApp ID or phone number for the person you want to send a message.
- messaging_product:
str
Sender service used for the request. Always use “whatsapp”.
- recipient_type:
str
Set this value to “individual”.
- context: Optional[
Context
] Used to mention a specific message you are replying to.
- type: Optional[
MessageType
] The type of message you want to send.
- audio:
Audio
A media object containing audio.
- contacts: List[
Contact
] A list of contact object.
- document:
Document
A media object containing a document.
- image:
Image
A media object containing a image.
- interactive:
Interactive
A interactive object.
- location:
Location
A location object.
- reaction:
Reaction
A reaction object.
- sticker:
Sticker
A sticker object.
- template:
Template
A template object.
- text:
Text
A text object.
- video:
Video
A media object containing a video.
- message_id:
str
The WhatsApp Business Account ID for the message you want to mark as read.
- status:
StatusType
Status message. Set this value to “read”.
- interactive: Optional[Interactive] = None¶
- message_id: Optional[str] = None¶
- messaging_product: Literal['whatsapp'] = 'whatsapp'¶
- recipient_type: Literal['individual'] = 'individual'¶
- status: Optional[StatusType] = None¶
- to: str¶
- type: Optional[MessageType] = None¶
- to:
- class wa_me.classes.messages.Name(formatted_name: str, first_name: Optional[str] = None, last_name: Optional[str] = None, middle_name: Optional[str] = None, prefix: Optional[str] = None, suffix: Optional[str] = None)[source]¶
Bases:
object
Name object.
Note
At least one of the optional parameters needs to be included along with the formatted_name parameter.
Parameters¶
- formatted_name:
str
Full name, as it normally appears.
- first_name: Optional[
str
] First name.
- last_name: Optional[
str
] Last name.
- middle_name: Optional[
str
] Middle name.
- prefix: Optional[
str
] Name prefix.
- suffix: Optional[
str
] Name suffix.
- first_name: Optional[str] = None¶
- formatted_name: str¶
- last_name: Optional[str] = None¶
- middle_name: Optional[str] = None¶
- prefix: Optional[str] = None¶
- suffix: Optional[str] = None¶
- formatted_name:
- class wa_me.classes.messages.Org(company: Optional[str] = None, department: Optional[str] = None, title: Optional[str] = None)[source]¶
Bases:
object
Org object.
Parameters¶
- company: Optional[
str
] Name of the contact’s company.
- department: Optional[
str
] Name of the contact’s department.
- title: Optional[
str
] The contact’s business title.
- company: Optional[str] = None¶
- department: Optional[str] = None¶
- title: Optional[str] = None¶
- company: Optional[
- class wa_me.classes.messages.Parameter(type: ParameterType, currency: Optional[Currency] = None, date_time: Optional[DateTime] = None, document: Optional[Document] = None, image: Optional[Image] = None, text: Optional[str] = None, video: Optional[Video] = None)[source]¶
Bases:
object
Parameter object.
Parameters¶
- type:
ParameterType
Indicates the type of parameter for the button.
- currency: Optional[
Currency
] A currency object.
- date_time: Optional[
DateTime
] A date_time object.
- document: Optional[
Document
] A media object containing a document.
- image: Optional[
Image
] A media object containing a image.
- text: Optional[
str
] The message’s text.
- video: Optional[
Video
] A media object containing a video.
- text: Optional[str] = None¶
- type: ParameterType¶
- type:
- class wa_me.classes.messages.Phone(phone: Optional[str] = None, type: Optional[PhoneType] = None, wa_id: Optional[str] = None)[source]¶
Bases:
object
Phone object.
Parameters¶
- phone: Optional[
str
] Automatically populated with the wa_id value as a formatted phone number.
- type: Optional[
PhoneType
] Phone type.
- wa_id: Optional[
str
] WhatsApp ID.
- phone: Optional[str] = None¶
- wa_id: Optional[str] = None¶
- phone: Optional[
- class wa_me.classes.messages.Product(product_retailer_id: str)[source]¶
Bases:
object
Product object.
Parameters¶
- product_retailer_id: :class`str`:
Unique identifier of the product in a catalog.
- product_retailer_id: str¶
- class wa_me.classes.messages.Reaction(emoji: str, message_id: str)[source]¶
Bases:
object
Reaction object.
Parameters¶
- emoji:
str
The emoji used for the reaction. Set this value to “” (empty string) to remove the reaction.
- message_id:
str
The WhatsApp Business Account ID that this reaction is being sent to.
- emoji: str¶
- message_id: str¶
- emoji:
- class wa_me.classes.messages.Row(id: str, title: str, description: Optional[str] = None)[source]¶
Bases:
object
Row object.
Parameters¶
- id: :class`str`:
Unique identifier row. Min: 1 char. Max: 200 chars.
- title: :class`str`:
Row title. Min: 1 char. Max: 24 chars.
- description: Optional[:class`str`:]
Row description. Min: 1 char. Max: 72 chars.
- description: Optional[str] = None¶
- id: str¶
- title: str¶
- class wa_me.classes.messages.Section(product_items: Optional[List[Product]] = None, rows: Optional[List[Row]] = None, title: Optional[str] = None)[source]¶
Bases:
object
Section object.
Parameters¶
- product_items: Optional[List[:class`.Product`:]]
A list of product object. Min: 1 item. Max: 30 items.
Note
Required for
InteractiveType.product_list
.- rows: Optional[List[:class`.Row`:]]
A list of row object. Min: 1 item. Max: 10 items.
Note
Required for
InteractiveType.list
.- title: Optional[:class`str`:]
Title of the section. Min: 1 char. Max: 24 chars.
Note
Required if the message has more than one section.
- title: Optional[str] = None¶
- class wa_me.classes.messages.Sticker(id: Optional[str] = None, link: Optional[str] = None)[source]¶
Bases:
Media
Sticker object.
- class wa_me.classes.messages.Template(name: str, language: Language, components: Optional[List[Component]] = None)[source]¶
Bases:
object
Template object.
Parameters¶
- name:
str
The name of the template.
- language:
Language
Specifies a language object. Specifies the language the template may be rendered in.
Note
Only the deterministic language policy works with media template messages.
- components: Optional[
Component
] A list of component object.
- name: str¶
- name:
- class wa_me.classes.messages.Text(body: str, preview_url: bool = False)[source]¶
Bases:
object
Text object.
Parameters¶
- body:
str
The text of the text message that can contain URLs and supports formatting. Max: 4096 chars.
- preview_url: Optional[
bool
] By default, WhatsApp recognizes URLs and makes them clickable, but you can also include a preview box with more information about the link. Set this field to true if you want to include a URL preview box.
The majority of the time when you send a URL, whether with a preview or not, the receiver of the message will see a URL that they can click on.
- URL previews are only rendered after one of the following has occurred:
The business has sent a message template to the user.
The user initiates a conversation with a “click to chat” link.
The user adds the business phone number to their address book
and initiates a conversation.
- body: str¶
- preview_url: bool = False¶
- body:
- class wa_me.classes.messages.URL(type: Optional[InfoType] = None, url: Optional[str] = None)[source]¶
Bases:
object
URL object.
Parameters¶
- type: Optional[
InfoType
] URL type.
- url: Optional[
str
] The URL.
- url: Optional[str] = None¶
- type: Optional[
- class wa_me.classes.messages.Video(id: Optional[str] = None, link: Optional[str] = None, caption: Optional[str] = None)[source]¶
Bases:
MediaWithCaption
Video object.
wa_me.classes.responses module¶
- class wa_me.classes.responses.BusinessProfile(messaging_product: Literal['whatsapp'], address: str, description: str, about: Optional[str], email: Optional[str], profile_picture_url: Optional[str], vertical: Optional[str], websites: Optional[List[str]])[source]¶
Bases:
object
Business profile object.
Parameters¶
- messaging_product:
str
The value is always “whatsapp”.
- address:
str
The address of the business.
Note
The maximum character limit for the string is 256.
- description:
str
Description of the business.
Note
The maximum character limit for the string is 256.
- about: Optional[
str
] The text to display in business profile’s About section.
Note
The max length for the string is 139 characters.
- email: Optional[
str
] The contact email address (in valid email format) of the business.
Note
The maximum character limit for the string is 128 characters.
- profile_picture_url: Optional[
str
] The handle of the profile picture generated from a call.
- vertical: Optional[
str
] The industry type of the business.
Note
- This can be one of the accepted values:
UNDEFINED, OTHER, AUTO, BEAUTY, APPAREL, EDU, ENTERTAIN, EVENT_PLAN, FINANCE, GROCERY, GOVT, HOTEL, HEALTH, NONPROFIT, PROF_SERVICES, RETAIL, TRAVEL, RESTAURANT, or NOT_A_BIZ.
- websites: Optional[List[
str
]] The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
Note
There is a maximum of 2 websites with a max of 256 characters each.
- about: Optional[str]¶
- address: str¶
- description: str¶
- email: Optional[str]¶
- messaging_product: Literal['whatsapp']¶
- profile_picture_url: Optional[str]¶
- vertical: Optional[str]¶
- websites: Optional[List[str]]¶
- messaging_product:
- class wa_me.classes.responses.Contact(input: str, wa_id: str)[source]¶
Bases:
object
Contact object.
Parameters¶
- input:
str
Contact phone number.
- wa_id:
str
WhatsApp ID.
- input: str¶
- wa_id: str¶
- input:
- class wa_me.classes.responses.Data(business_profile: BusinessProfile)[source]¶
Bases:
object
Information about a business profile.
Parameters¶
- business_profile: List[
BusinessProfile
] The value is always “whatsapp”.
- business_profile: BusinessProfile¶
- business_profile: List[
- class wa_me.classes.responses.Error(code: int, error_subcode: int, fbtrace_id: str, message: str, type: str, error_data: Optional[ErrorData] = None)[source]¶
Bases:
object
Error object.
Parameters¶
- code:
int
Error code.
Note
For more information, refer to: https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes#error-codes
- error_subcode:
int
The subcode of the error.
- fbtrace_id:
str
For Facebook Support.
- message:
str
The title of this error.
- type:
str
The type of error.
- error_data: Optional[
ErrorData
] Error details data.
- code: int¶
- error_subcode: int¶
- fbtrace_id: str¶
- message: str¶
- type: str¶
- code:
- class wa_me.classes.responses.ErrorData(messaging_product: Literal['whatsapp'], details: str)[source]¶
Bases:
object
Error details data object.
Parameters¶
- messaging_product:
str
The value is always “whatsapp”.
- details:
str
Describes the detailed error messages to help you debug the error.
- details: str¶
- messaging_product: Literal['whatsapp']¶
- messaging_product:
- class wa_me.classes.responses.Media(messaging_product: Literal['whatsapp'], id: str, mime_type: str, file_size: int, sha256: str, url: str)[source]¶
Bases:
object
Business profile object.
Parameters¶
- messaging_product:
str
The value is always “whatsapp”.
- id:
str
The media object ID.
- mime_type:
str
Mime type of the media file.
- file_size:
int
The media file size.
- sha256:
str
Hash for the file.
- url:
str
The protocol and URL of the media.
- file_size: int¶
- id: str¶
- messaging_product: Literal['whatsapp']¶
- mime_type: str¶
- sha256: str¶
- url: str¶
- messaging_product:
- class wa_me.classes.responses.Message(id: str)[source]¶
Bases:
object
Message object.
Parameters¶
- id:
str
The ID for the message that was sent by the business
- id: str¶
- id:
- class wa_me.classes.responses.Profile(data: List[Data])[source]¶
Bases:
object
Profile response object.
Parameters¶
- data: List[
Data
] The value is always “whatsapp”.
- data: List[
- class wa_me.classes.responses.Readed(success: bool)[source]¶
Bases:
object
Readed object.
Parameters¶
- success:
bool
Indicates whether a message was successfully read.
- success: bool¶
- success:
- class wa_me.classes.responses.Response(messaging_product: Literal['whatsapp'], contacts: List[Contact], messages: List[Message])[source]¶
Bases:
object
Message response object.
Parameters¶
- messaging_product:
str
The value is always “whatsapp”.
- contacts: List[
Contact
] A list of contact object.
- messages: List[
Message
] Information about a message sent by the business
- messaging_product: Literal['whatsapp']¶
- messaging_product: