Integrating WhatsApp into Home Assistant – Part 4: Sending Stickers

Integrating WhatsApp into Home Assistant – Part 4: Sending Stickers

In Part 3 of this series of posts, we explored how to send images and audio messages through WhatsApp in Home Assistant, giving your smart home notifications a whole new level of context. While text, images, and audio are the essentials, sending stickers is a fun, “nice-to-have” feature that can add personality to your notifications. This post covers how to send stickers from Home Assistant through WhatsApp, picking up from where we left off in the previous parts of the series.

If you’re just getting started with WhatsApp integration, make sure to review Part 1 and Part 2 for the initial setup and basic functionality. Now, let’s get into the specifics of sending stickers.

Sending Stickers: The Setup

For a long time, I searched for a reliable way to send stickers through WhatsApp in Home Assistant. After reaching out to the developer on the WhatsApp addon, I did not get a response and the ticket was closed as “not planned”. However, This add-on relies on an open-source library, Baileys, which enables the communication with WhatsApp, and it holds some hidden gems that are often undocumented.

After some deep digging, I found a way to send stickers with minimal hassle. Here’s the simplest setup to make it work.

Setting Up a Sticker Script

You’ll need to create a script (or add it to an automation) in Home Assistant. Here’s the code to get started:

    action: whatsapp.send_message
    data:
      clientId: default
      to: [your whatsapp id]
      body:
        sticker:
          url: /config/38bd6d24-8a95-474c-9b19-01b369e70448.webp

Replace [your whatsapp id] with your own chat WhatsApp ID. This is either the ID of a private chat or a group chat, as explained in previous posts.

Where to Store Your Sticker Files

The sticker file you want to send has to be a .webp format and it can be placed anywhere in the Home Assistant paths. I found that /config/ folder, accessible as “homeassistant” in the Home Assistant file editor, works great. Just remember to use /config/ in the URL within your script.

You can find webp sticker files on various websites, or even create your own. For testing, you can start with the example provided in the code above, which has been confirmed to work, and you can try this image:

Things to Keep in Mind

  1. File Location: The file must be in the /config/ directory for the URL to be valid within Home Assistant (or a subfolder of /config/, feel free to create a “stickers” subfolder to keep organized).
  2. File Format: Only .webp files are supported, as WhatsApp recognizes these as stickers.

Throughout this series, we’ve covered sending texts, images, audio, and now stickers to both individual WhatsApp accounts and groups. Unfortunately, WhatsApp limits certain features (e.g., buttons, polls) which are available in other platforms like Telegram but were removed from regular WhatsApp. These features are likely reserved for the paid WhatsApp Business service. I’m always on the lookout for new ways to expand WhatsApp capabilities in Home Assistant, so if you discover something new, feel free to reach out!


Comments

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

Leave a Reply