Send a photo with telegram - Node-RED

hello everyone
I’m about to set up a telegram node red notification with photo attachment.

If I now insert a public image like “http://domain.com/photo123/test.jpg” everything will work.

Only if I enter my Home-Assistant URL “http://hassio-ip:8123/local/pic.jpg” nothing works, the debug messages will not output anything.

The URL is locally available without authentication.

I use this Add-on:

EDIT:

Wait, I misread the question, I missed the “public” part. Where is this photo coming from? Is it possible to copy it locally, or is it something that changes periodically out on the internet that you want to send?

For telegram, have you looked into Redbot? - https://flows.nodered.org/node/node-red-contrib-chatbot

It has a little higher learning curve than telegrambot, but it’s much more powerful. There is an image node that can access public and local files and send them on. -https://github.com/guidone/node-red-contrib-chatbot/wiki/Image-node

You shouldn’t need to include the entire URL of the file. If it’s in the www folder in the root of your config folder, you can start with “local/name_of_pc”.

Here’s how I did it with my Skybell doorbell - https://theautomationplace.com/2019/10/12/sending-picture-notifications-with-node-red-and-telegram/

AFAIK you need to be available from the web. So if you have a duckdns url simply put this in.

i.e.:
I use this for my Push Notifcation of an image: {“title”:“Home Assistant Alarm”,“message”:“My Message”,“data”:{“image”:“https://MYURL.duckdns.org/local/snapshots/image.jpg”}}

Question, do you use a Telegram-bot? Do you use HA Node Red add-on or a separate Node-Red config (on a RasPi for example)?

FYI, you could check my topic for more info:
https://community.home-assistant.io/t/howto-setting-up-a-telegram-bot-for-all-your-home-automation-messages

Hello everyone, thank you for your suggestion.

I use the Node red-telegram integration:

The URL is available in my whole home network which should be enough? I don’t want to make Home-Assistant publicly available.

as already written the telegram messenger can send and receive. Also it works with a public URL only with the Hassio URL it does not work.

1 - You don’t have to need to make HA publicly available to send/receive using Node-Red.
BTW, did you configured the Node-Red add-on its Container network host setting to be communicating with LAN by entering the port (xxxx)?

Network

Container Host Description
80/tcp xxxx Web interface

2 - When using the HA Telegram integration, you can only send with the broadcast platform-option, otherwise you need to get HA publicly available for receiving and change the platform-option to webhook or polling. Check for more info:

I never tried it but maybe you could use the config like @ PickleSlice did for sending videos with the use of broadcast platform-option?

You can check Telegram-integration (broadcast) by using HA Developer --> Tools --> Services

Service: telegram_bot.send_photo
Service Data:
file: “/config/www/image.png” <-- path to your local image
caption: “My image”

Worked for me…

1 Like

I just switching over from pushbullet to telegram I am using the call service node same thing I can receive the text but not the photo. The photo is not from a camera or anything it’s just a simple photo sitting in the www directory.

One thing I see everyone missed is when adding a photo to the directory you need to restart home assistant just as you would if you made a change to any of the files.

This however has not helped.

I can access the image if I paste the address into chrome in guest mode (eg no login details required)

and in the data box

{
    "title": "HA",
    "message": "My description",
    "data": {
        "image": "https://myurl.duckdns.org/local/image.gif"
    }