Releases: david-lev/pywa
4.0.0b6
What's Changed
Update with pip:
pip install -U pywa --pre
Updated Docs: pywa.readthedocs.io/en/dev/
Caution
Make sure to read the migration guide before updating to this version!
- [client] add
runmethod to start the webhook server and listen for updates - [server] refactor webhook handling to include validation and improve endpoint management
- [user] make
profiletemporary optional for testing - [utils] add
start_ngrok_tunnelfunction to facilitate local webhook testing - [templates] enhance
duplicatemethod to includetarget_waba_idparameter for template creation - [templates] add validation for URL variables in
URLButtonto enforce constraints on example and variable usage
Full Changelog: 4.0.0b5...4.0.0b6
4.0.0b5
What's Changed
Update with pip:
pip install -U pywa --pre
Updated Docs: pywa.readthedocs.io/en/dev/
Caution
Make sure to read the migration guide before updating to this version!
- [client] add methods for creating and verifying phone numbers on WhatsApp Business Account
- [templates] enhance
TemplateandTemplateDetailswith new methods for component retrieval and validation - [templates] add
param_namesproperty for introspection of named parameters - [templates] enhance error handling for positional and named examples in
HeaderTextandBodyText - [templates] enhance
CreativeFeaturesSpecwith new attributes for improved media handling and text optimization - [templates] remove
TemplateSubCategoryclass and updatesub_categorytype to string - [message] fix reply to message in
EditedMessageandDeletedMessage
Full Changelog: 4.0.0b4...4.0.0b5
4.0.0b4
What's Changed
Update with pip:
pip install -U pywa --pre
Updated Docs: pywa.readthedocs.io/en/dev/
Caution
Make sure to read the migration guide before updating to this version!
- [client] update
webhook_fieldstype to supportutils.WebhookFieldsand enhance handling logic - [client] replace
business_account_idwithwaba_idacross the codebase - [client] add methods to retrieve shared and owned WABAs
- [message] add
OutgoingMessage,OutgoingEditedMessageandOutgoingDeletedMessageclasses for message updates - [message] add
EditedMessageandDeletedMessageclasses for message updates - [contacts] add
ContactListclass for shared contacts handling - [media] store
captioninside media objects - [groups] add
GroupOperationclass and update group-related methods to return operation responses - [callback] update
VoiceCallButtonto supporttimedeltaforttl_minutes - [errors] add
rawerror field and new group/template error classes
Full Changelog: 4.0.0b3...4.0.0b4
4.0.0b3
What's Changed
Update with pip:
pip install -U pywa --pre
Updated Docs: pywa.readthedocs.io/en/dev/
Caution
Make sure to read the migration guide before updating to this version!
- [client] add
SUPPORTS_BSUID_APIflag and update user identifier resolution logic - [templates] fix summary fields in
TemplatesResult - [ci] update checkout action to use workflow_run head_sha reference
Full Changelog: 4.0.0b1...4.0.0b3
4.0.0b1
What's Changed
Update with pip:
pip install -U pywa --pre
Updated Docs: pywa.readthedocs.io/en/dev/
Caution
Make sure to read the migration guide before updating to this version!
- [user] implement BSUID changes
- [user] added
country_codefield - [groups] add group management features
- [handlers] implement
GroupMessageStatusesclass and handler for group message status updates - [message_status] add new
PricingCategory:general_purpose_ai - [filters] update
from_countriesto supportcountry_code - [filters] add filters for
privateandgroupchat messages - [templates] add
ContactInfoRequestButtoncomponent - [templates] add to
CreativeFeaturesSpectwo classmethods:all_enabledandall_disabled - [others] add
BlockedUserandUnblockedUserfor user blocking functionality - [types] remove
ChatOpenedreferences and related code
Full Changelog: 3.9.0...4.0.0b1
3.9.0
What's Changed
Update with pip:
pip3 install -U pywa
- [base_update] edit
reply_templateto acceptTemplateobj - [templates] add
auto_promotion_tagfield toCreativeFeaturesSpec - [templates] fix template params validation in async (reported by @val-2 in #171)
- [templates] fix filters import in
wait_until_approved(reported by @SirKaiMartin in #175)
from pywa import WhatsApp
from pywa.types.templates import *
template = Template(
name="buy_new_iphone_x",
category=TemplateCategory.MARKETING,
language=TemplateLanguage.ENGLISH_US,
parameter_format=ParamFormat.NAMED,
components=[
ht := HeaderText("The New iPhone {{iphone_num}} is here!", iphone_num=17),
bt := BodyText(
"Buy now and use the code {{code}} to get {{per}}% off!",
code="WA_IPHONE_15",
per=17,
),
FooterText(text="Powered by PyWa"),
Buttons(
buttons=[
url := URLButton(
text="Buy Now",
url="https://example.com/shop/{{1}}",
example="iphone17",
),
PhoneNumberButton(text="Call Us", phone_number="1234567890"),
qrb1 := QuickReplyButton(text="Unsubscribe from marketing messages"),
qrb2 := QuickReplyButton(text="Unsubscribe from all messages"),
]
),
],
)
wa = WhatsApp(...)
@wa.on_message
def send_marketing_message(_: WhatsApp, m: Message):
m.reply_template(
template=template, # Use the template object to validate params *before* sending
params=[
ht.params(iphone_num=30),
bt.params(code="WA_IPHONE_30", per=30),
url.params(url_variable="iphone30", index=0),
qrb1.params(callback_data="unsubscribe_from_marketing_messages", index=1),
qrb2.params(callback_data="unsubscribe_from_all_messages", index=2),
],
)Full Changelog: 3.8.0...3.9.0
3.8.0
What's Changed
Update with pip:
pip3 install -U pywa
- [templates] enhance template parameters validation and improve component handling
- [types] update
BusinessProfileto allow optional 'about' field (reported by @riklaunim in #169)
from pywa import WhatsApp
from pywa.types.templates import *
template = Template(
name="buy_new_iphone_x",
category=TemplateCategory.MARKETING,
language=TemplateLanguage.ENGLISH_US,
parameter_format=ParamFormat.NAMED,
components=[
ht := HeaderText("The New iPhone {{iphone_num}} is here!", iphone_num=17),
bt := BodyText(
"Buy now and use the code {{code}} to get {{per}}% off!",
code="WA_IPHONE_15",
per=17,
),
FooterText(text="Powered by PyWa"),
Buttons(
buttons=[
url := URLButton(
text="Buy Now",
url="https://example.com/shop/{{1}}",
example="iphone17",
),
PhoneNumberButton(text="Call Us", phone_number="1234567890"),
qrb1 := QuickReplyButton(text="Unsubscribe from marketing messages"),
qrb2 := QuickReplyButton(text="Unsubscribe from all messages"),
]
),
],
)
wa = WhatsApp(...)
wa.send_template(
to="9876543210",
template=template, # Use the template object to validate params *before* sending
params=[
ht.params(iphone_num=30),
bt.params(code="WA_IPHONE_30", per=30),
url.params(url_variable="iphone30", index=0),
qrb1.params(callback_data="unsubscribe_from_marketing_messages", index=1),
qrb2.params(callback_data="unsubscribe_from_all_messages", index=2),
],
)Full Changelog: 3.7.0...3.8.0
3.7.0
What's Changed
Update with pip:
pip3 install -U pywa
- [media] allow to override the default 1-hour TTL for
No Storage-enabledbusiness phone numbers - [types] add
QRCodeImageTypeand enhanceQRCodemethods for image handling - [templates] adding
product_extensionsandtext_formatting_optimizationtoCreativeFeaturesSpec - [api] add method to exchange Embedded Signup token for business access token
- [ci] update GitHub Actions workflows for improved publishing and testing
- [core] support Python 3.14
Full Changelog: 3.6.1...3.7.0
3.6.1
What's Changed
Update with pip:
pip3 install -U pywa
- [helpers] fix media URL in template param (reported in #160 by @riklaunim)
- [tests] test resolve_media_param
Full Changelog: 3.6.0...3.6.1
3.6.0
What's Changed
Update with pip:
pip3 install -U pywa
- [client] allow any media type in
update_business_profile(profile_picture=...)arg - [sent_message] adding new
SentReactiontype for replying and reacting to the original message - [media] allowing usage in context manager to delete media after use
- [templates] moving
TemplateStatusUpdatefields into objects - [message_status] fixing
MessageStatus.pricing.typeparsing by @Janson-L in #158 - [utils] bump
flow_data_apito4.0
from pywa import WhatsApp, filters, types
wa = WhatsApp(...)
# media will be automatically deleted from WhatsApp servers after exiting the context
with wa.upload_media("/path/to/sensitive_image.png") as media:
wa.send_image(to=..., image=media)
@wa.on_message(filters.command("start"))
def on_start(_: WhatsApp, m: types.Message):
doc = m.reply("Please send your ID as a document.").wait_for_reply(filters=filters.document).document
# document will be automatically deleted from WhatsApp servers after exiting the context
with doc:
# process the document stream securely
upload_to_secure_storage(file=doc.stream())from pywa import WhatsApp
wa = WhatsApp(...)
wa.update_business_profile(
# use any media source supported by pywa
profile_picture=pathlib.Path("/path/to/image.png")
)Full Changelog: 3.5.2...3.6.0