Create a title for telegram messages

Hi all,

I am new to node-red i have home assistant and i wanted to transfer many of my automation to node-red

in HA you have the ability to create a title when you are sending a message (it's just a bold line before the text)

i tried to achieve the same thing in node-red but i don't know how to do it
this is my code

msg.payload.chatId = 530000000;
msg.payload.type = 'message';
msg.payload.content = 'text';
return msg;

and i am using node-red-contrib-telegrambot

any help for newbie will be gladly appreciated

You can do this by indicating to Telegram that it should use markdown enhanced messages. The markup is very limited but you can do bold, italic and fixed-width font.

On my generic Telegram output flow, I use a simple JSONata change node to change the payload before sending:

    "chatId": chatId,
    "content": "*" & $replace(topic, "_", " ") & "*\n" & $join($split(payload, "<br>"), "\n"),
    "type": contentType,
    "options": { 
        "parse_mode": "Markdown"
1 Like

Have you tried the examples?

Node-red - menu - import - examples.

A quick look at the source for this node suggests you can make msg.content an object and one of the properties is title. So there may be a format that permits sending rich/html or text with .title set? Pure speculation.

Thanks that's solved my problem
I've added the code for future people to see :slight_smile:

msg.payload.options = {parse_mode : "Markdown"};
msg.payload.chatId = 530000000;
msg.payload.type = 'message';
msg.payload.content = '*Title* \r\n Text';
return msg;