# Create a title for telegram messages

**URL:** <https://discourse.nodered.org/t/create-a-title-for-telegram-messages/12505>\
**Category:** General\
**Created:** [23 June 2019 09:42 UTC](https://discourse.nodered.org/t/create-a-title-for-telegram-messages/12505 "2019-06-23T09:42:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ygarti](https://avatars.discourse-cdn.com/v4/letter/y/f475e1/32.png) [@ygarti](https://discourse.nodered.org/u/ygarti)\
**Post date:** [23 June 2019 09:42 UTC](https://discourse.nodered.org/t/create-a-title-for-telegram-messages/12505/1 "2019-06-23T09:42:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 June 2019 10:09 UTC](https://discourse.nodered.org/t/create-a-title-for-telegram-messages/12505/2 "2019-06-23T10:09:21Z")

</div>

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.

> **[Telegram Bot API](https://core.telegram.org/bots/api#markdown-style)**
>
> The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
> To learn how to create…

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

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

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 June 2019 10:09 UTC](https://discourse.nodered.org/t/create-a-title-for-telegram-messages/12505/3 "2019-06-23T10:09:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ygarti](https://avatars.discourse-cdn.com/v4/letter/y/f475e1/32.png) [@ygarti](https://discourse.nodered.org/u/ygarti)\
**Post date:** [23 June 2019 11:16 UTC](https://discourse.nodered.org/t/create-a-title-for-telegram-messages/12505/4 "2019-06-23T11:16:42Z")

</div>

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

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

```
