EvolutionAPI / evolution-api

Evolution API is an open-source WhatsApp integration API
https://evolution-api.com
GNU General Public License v3.0
938 stars 484 forks source link

feat(endpoint): add setPresence endpoint #479

Closed dv336699 closed 3 months ago

dv336699 commented 3 months ago

This endpoint will allow you to set an instance presence without a phone number.

image

DavidsonGomes commented 3 months ago

Sorry, but what is the application? and how does it differ from SendPresence?

Screenshot 2024-03-19 at 10 07 43
dv336699 commented 3 months ago

Hi,

Thanks for considering this.

The method from Baileys, SendPresence, doesn't require a phone number.

The endpoint chat/SendPresence enforces a phone number.

As per https://github.com/WhiskeySockets/Baileys?tab=readme-ov-file#update-presence you can call SendPresence without a number to mark the device as unavailable.

Note: In the multi-device version of WhatsApp -- if a desktop client is active, WA doesn't send push notifications to the device. If you would like to receive said notifications -- mark your Baileys client offline using sock.sendPresenceUpdate('unavailable')

Here is a snippet from the WhatsApp group with more details.

image

I didn't want to touch the chat/sendPresence endpoint as to avoid breaking changes in the future.

Let me know if you have any more questions.

Thanks