Enhancing Your WhatsApp Bot in Home Assistant with Presence Updates

Enhancing Your WhatsApp Bot in Home Assistant with Presence Updates

In previous posts, I’ve covered my custom fork of the WhatsApp add-on for Home Assistant, adding features like image and video sending, group messaging, and more. If you haven’t read about it yet, check out my posts here:
My customized addon
Sending stickers
Sending images and audio
Sending messages to a group

One small but interesting feature that’s not well documented is the presence update functionality. This allows the bot to send a “typing…” indication when processing a task, creating a more natural user experience. While it’s not essential, it can make interactions with your WhatsApp bot feel smoother and more interactive.

How to Add a “Typing…” Indicator

To make the bot show a “typing…” effect while it’s working on a response, simply add this automation step:

action: whatsapp.send_presence_update
data:
  to: "{{trigger.event.data.key.remoteJid}}"
  type: composing
  clientId: default

This command will send a “typing…” indication to the chat that triggered the automation.

Stopping the “Typing…” Effect

Once your automation completes the task, you should send an update to stop the indicator. To do this, replace "composing" with "paused" in your automation step:

action: whatsapp.send_presence_update
data:
  to: "{{trigger.event.data.key.remoteJid}}"
  type: paused
  clientId: default

Conclusion

That’s it! By adding these simple steps, your WhatsApp bot can provide a more engaging and realistic chat experience. Whether you’re using it for notifications, responses, or interactive automations, this feature is a nice touch to make conversations feel more fluid.


Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply