Sending Messages Errors#

class pywa.errors.SendMessageError#

Bases: WhatsAppError

Base exception for all message errors.

class pywa.errors.MessageUndeliverable#

Bases: SendMessageError

Unable to deliver message. Reasons can include:

  • The recipient phone number is not a WhatsApp phone number.

  • Recipient has not accepted our new Terms of Service and Privacy Policy.

  • Recipient using an old WhatsApp version; must use the following WhatsApp version or greater:

    Android: 2.21.15.15 SMBA: 2.21.15.15 iOS: 2.21.170.4 SMBI: 2.21.170.4 KaiOS: 2.2130.10 Web: 2.2132.6

class pywa.errors.ReEngagementMessage#

Bases: SendMessageError

More than 24 hours have passed since the recipient last replied to the sender number.

class pywa.errors.UnsupportedMessageType#

Bases: SendMessageError

The message type is not supported.

class pywa.errors.RecipientNotInAllowedList#

Bases: SendMessageError

When using test numbers, you can add up to 5 numbers that can receive messages. This error is raised when the recipient is not in the list.

class pywa.errors.InvalidParameter#

Bases: SendMessageError

The parameter you passed is invalid.

class pywa.errors.MissingRequiredParameter#

Bases: SendMessageError

You must provide a value for the required parameter.

class pywa.errors.MediaDownloadError#

Bases: SendMessageError

Unable to download the media sent by the user.

class pywa.errors.MediaUploadError#

Bases: SendMessageError

Unable to upload the media used in the message.

class pywa.errors.TemplateParamCountMismatch#

Bases: SendMessageError

The number of variable parameter values included in the request did not match the number of variable parameters defined in the template..

class pywa.errors.TemplateParamFormatMismatch#

Bases: SendMessageError

Variable parameter values formatted incorrectly.

class pywa.errors.TemplateNotExists#

Bases: SendMessageError

The template does not exist in the specified language or the template has not been approved.

class pywa.errors.TemplateTextTooLong#

Bases: SendMessageError

The template text is too long.

class pywa.errors.GenericError#

Bases: SendMessageError

Generic error.

class pywa.errors.UnknownError#

Bases: SendMessageError

Message failed to send due to an unknown error.

class pywa.errors.AccessDenied#

Bases: SendMessageError

Permission is either not granted or has been removed.

class pywa.errors.ServiceUnavailable#

Bases: SendMessageError

A service is temporarily unavailable.

class pywa.errors.RecipientCannotBeSender#

Bases: SendMessageError

Sender and recipient phone number is the same.

class pywa.errors.BusinessPaymentIssue#

Bases: SendMessageError

Message failed to send because there were one or more errors related to your payment method.

class pywa.errors.IncorrectCertificate#

Bases: SendMessageError

Message failed to send due to a phone number registration error.

class pywa.errors.AccountInMaintenanceMode#

Bases: SendMessageError

Business Account is in maintenance mode

class pywa.errors.UserIsInExperimentGroup#

Bases: SendMessageError

The user is part of an experiment group and the message was not sent as part of an experiment.

See Marketing Message Experiment.

class pywa.errors.RecipientIdentityKeyMismatch#

Bases: SendMessageError

The recipient’s identity key hash does not match the one on record.

This can happen if the user has reinstalled WhatsApp or changed devices. Confirm the correct Recipient Identity Key Hash or send without any identity key hash.

class pywa.errors.UserStoppedMarketingMessages#

Bases: SendMessageError

User has stopped marketing messages from the business account. you should listen to UserMarketingPreferences updates

class pywa.errors.BSUIDRecipientNotSupported#

Bases: SendMessageError

Business-scoped User ID (BSUID) recipients are not supported for this message.

class pywa.errors.MarketingTemplatesDisabledForCloudAPI#

Bases: SendMessageError

Marketing templates are disabled for Cloud API.

To send this template, use the Marketing Messages API for WhatsApp or enable marketing templates on Cloud API by turning off disable_marketing_messages_on_cloud_api.