Discord Image Notification

Does anyone use Discord notifications and specifically with images?

I want to send an image to Discord but struggling. It works fine in Telegram

Anyone have an example payload I can test with please?

Still struggling with this, any ideas guys?

Not to be an ass, but have you looked at the docs? It’s literally the only example service call.

Yeah, sorry I should have mentioned.

Here’s a test automation:

  - alias: 'test'
    trigger:
    - platform: state
      entity_id: sensor.hallmotion
    action:
    - service: notify.hass
      data:
        message: "test"
        target: [myid]
        data:
          images: "/local/test.jpg"

I only get the “test” message, not the test jpg.

Is the file located at config/www/test.jpg?

Yep.

I’ve tried “/tmp/test.jpg” also.

The same image locations work on Telegram, but not Discord and feel like I’m just missing something somewhere.

lemme look at the code

try:

    - service: notify.hass
      data:
        message: "test"
        target: [myid]
        data:
          images: 
            - /local/test.jpg

The component doesn’t appear to validate the schema, so it’s hard to tell what they expect. It does.

That doesn’t work either I’m afraid, thank you for the advice however.

I’m at a loss…

Same here. I’d have to set it up and play around. Try removing the .jpg. Also, try just exposing the folder. It’s odd that the example doesn’t have a file extension in the docs.

Checking the logs, it states the image has not been found, which it definately exists.

Also tried it without the .jpg, same result. Also tried another file (png) doesn’t work either.

2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: /
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: l
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: o
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: c
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: a
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: l
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: /
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: t
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: e
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: s
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: t
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: .
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: j
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: p
2019-09-10 13:14:42 WARNING (MainThread) [homeassistant.components.discord.notify] Image not found: g

Yeah, but see what it’s doing? it’s splitting up the string into individual letters. Which config are you using when you get that output?

try this

    - service: notify.hass
      data:
        message: "test"
        target: [myid]
        data:
          images: 
            - /config/www/test.jpg
1 Like

That works!

So it needs the /config/ then. That’s great, thanks for your help!

It seems as if they don’t use the local -> config/www function. That’s a bug!

If your interested, created a pr. It may work whenever they fix this.

1 Like

Still not fixed :frowning: could do with referencing this in the Discord docs

As you say though, this works for anything in the /www/ folder

service: notify.[BOT NAME]
data:
  target:
    - '[CHAT ID]'
  message: Hello
  data:
    images:
      - /config/www/test.png

covered in the notes section, even explains why.

1 Like

Has anyone tried or had any success getting Home Assistant to upload an image into a Discord embed?
There are definitely bots with this functionality (Octoprint being one), but it seems the Home Assistant integration doesn’t support it.

service: notify.discord
data:
  message: ""
  target:
    - "sometarget"
  data:
    embed:
      title: Mono X Printing Started <:printer:>
      color: 16765696
      author:
        name: Home Assistant Bot
        url: myurl
        icon_url: https://www.home-assistant.io/images/favicon-192x192-full.png
      thumbnail:
        url: https://3dprinting.com/wp-content/uploads/anycubic-logo.png
      image:
        url: /media/photon.jpg # doesn't work (obviously not a URL)
    images:
      - /media/photon.jpg # works, but appears ABOVE the embed

Example with ideal behavior on top, current behavior on bottom:

I got it going, if u want i can share it for you.
i needed exactly the same thing, so i fixed it.

So i have it twoo ways, first one is with an embedcode and second one with node red

I’ve never messed with Node Red before, but if you got it working using native embeds, I’d love to see how.

Thanks!