fix: announce pushname via available presence after connect#252
Merged
Conversation
whatsmeow's SendPresence docs warn that the server only learns the linked-device pushname once an "available" presence is sent. Without that call, downstream recipients receive notify="" / "-" for messages sent through wacli. WhatsApp Business app contacts tolerate this, but Cloud API verified-business webhook pipelines silently drop messages from senders with an empty pushname — the send still receives a <biz/> delivery ack at the gateway, so the failure is invisible to the sender. Send the presence once after every authenticated connect (when a pushname is available). Failure is logged to stderr and ignored so it never blocks the connect.
5a1dde1 to
04eb618
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Presence: availableafter every successful authenticated connect so the server records the linked-device pushname.notify=""/"-", and Cloud API verified-business webhook pipelines silently drop those messages at the gateway — the send still receives a<biz/>delivery ack so the failure is invisible from the sender side.Why
whatsmeow's own
SendPresencedocs already warn:WhatsApp Business app contacts tolerate the missing pushname, which is why this has not surfaced before. Meta Cloud API (
verified_level="high") bots do not: their webhook never fires for senders without a valid pushname, even though the server gateway acknowledges delivery.Notes
SendPresenceis logged to stderr and ignored so it never blocks the connect.len(cli.Store.PushName) > 0becauseSendPresencereturnsErrNoPushNameotherwise (and pre-auth flows reach this branch with an empty store).internal/wasuite doesn't have a fake whatsmeow client to assert against. Verified manually against a Cloud API business chat that was silently dropping wacli sends — the bot started replying within seconds once this was in place.Human note
Same as #240, I don't know golang, I asked my claw to try fix it and it did, then I asked to open a PR and it probably has slop. Feel free to close but you can use it as a reference to actually fix the problem.