Telegram - how to send an image

Hi.

Sending a message to telegram. it works.
I don't know how to add an image.
Advice?
Thank you.

Did you check in the built in examples ?

I can send text (Message).
I can send a photo.
I can't send text + photo at once

No at computer, but i seem to remember that you can send a caption with a image. msg.payload.caption I think. https://raw.githubusercontent.com/windkh/node-red-contrib-telegrambot/refs/heads/master/examples/sendphoto.json

This is a simple flow example (if you would like to view the image being sent in the NR editor, please install node-red-contrib-image-tools ). The example monitors a folder and if you drop an image to it, it will be read and sent. Obviously you can feed the function node with image data directly in other ways

[
    {
        "id": "88d8ff214f48ece7",
        "type": "function",
        "z": "be169c56949ba685",
        "name": "Create image for Telegram",
        "func": "var cId = 123456;\n\nmsg.payload = { chatId: cId, type:\"photo\", content:msg.payload, caption:\"Snapshot of image\"};\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 730,
        "y": 80,
        "wires": [
            [
                "95114cabc3339005"
            ]
        ]
    },
    {
        "id": "95114cabc3339005",
        "type": "telegram sender",
        "z": "be169c56949ba685",
        "name": "",
        "bot": "a0a9832f.04aa5",
        "haserroroutput": false,
        "outputs": 1,
        "x": 980,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "47abe4fc60e4e1ae",
        "type": "image viewer",
        "z": "be169c56949ba685",
        "name": "",
        "width": 160,
        "data": "payload",
        "dataType": "msg",
        "active": true,
        "x": 720,
        "y": 150,
        "wires": [
            []
        ]
    },
    {
        "id": "d9231585ae2a792b",
        "type": "file in",
        "z": "be169c56949ba685",
        "name": "",
        "filename": "filename",
        "filenameType": "msg",
        "format": "",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 500,
        "y": 80,
        "wires": [
            [
                "88d8ff214f48ece7",
                "47abe4fc60e4e1ae",
                "c8aa613381b1b29b"
            ]
        ]
    },
    {
        "id": "dd24b7769ad4adf7",
        "type": "watch",
        "z": "be169c56949ba685",
        "name": "",
        "files": "/home/pi/Pictures",
        "recursive": "",
        "x": 170,
        "y": 80,
        "wires": [
            [
                "86107013c36ba942"
            ]
        ]
    },
    {
        "id": "946937a69c9686d3",
        "type": "comment",
        "z": "be169c56949ba685",
        "name": "Monitor folder for new images and send them via Telegram",
        "info": "",
        "x": 290,
        "y": 40,
        "wires": []
    },
    {
        "id": "86107013c36ba942",
        "type": "delay",
        "z": "be169c56949ba685",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 350,
        "y": 80,
        "wires": [
            [
                "d9231585ae2a792b"
            ]
        ]
    },
    {
        "id": "a0a9832f.04aa5",
        "type": "telegram bot",
        "botname": "Testchat",
        "usernames": "",
        "chatids": "",
        "baseapiurl": "",
        "updatemode": "polling",
        "pollinterval": "300",
        "usesocks": false,
        "sockshost": "",
        "socksport": "6667",
        "socksusername": "anonymous",
        "sockspassword": "",
        "bothost": "",
        "botpath": "",
        "localbotport": "8443",
        "publicbotport": "8443",
        "privatekey": "",
        "certificate": "",
        "useselfsignedcertificate": false,
        "sslterminated": false,
        "verboselogging": false
    }
]

I think you will find msg.payload.type should be 'photo' not 'message' in the 'change' node.

You can also include a caption for the photo with...

msg.payload.caption "this is a photo of a cat"

It already works. Thank you