What am I doing wrong with this multi-line value in markdown for notifications?

The markdown in this automation YAML is not working as expected… the message contents makes it through but the markdown is lost (nothing is bolded). It’ must be something simple I’m missing:

service: notify.telegram_my_bot
data:
  message: |-
    **Maintain Room Temp (Night)**
    **Kids Room Temp:** {{ states('sensor.kids_room_temperature') }} degrees
    **Heater:** Turning {{ states('switch.kids_room_heater') }}

Messages in Telegram come through without markdown formatting of the bolding:

image

Single asterisk around the text for bold.

e.g.

    service: notify.telegram_system
    data:
      title: '*Information*'
      message: "A *beta* update for Home Assistant is available. You are running {{states('sensor.installed_version') }}, the latest beta version is {{ states('sensor.beta_version') }}."

But what if I want to define it as multi line? In YAML, I thought this was done with the | or |>

Use >

That doesn’t work.

message: >
  **Maintain Room Temp (Night)**
  **Kids Room Temp:** {{ states('sensor.kids_room_temperature') }} degrees
  **Heater:** Turning {{ states('switch.kids_room_heater') }}

ends up with:

message: |
  **Maintain Room Temp (Night)**
  **Kids Room Temp:** {{ states('sensor.kids_room_temperature') }} degrees
  **Heater:** Turning {{ states('switch.kids_room_heater') }}

the same as if I use |-:
image

I figured it out. It was indeed the double asterisk that was causing the issue. I thought telegram used markdown syntax, so bolding would be double asterisk but it’s not?

message: |-
  *Maintain Room Temp (Night)*
  *Kids Room Temp:* {{ states('sensor.kids_room_temperature') }} degrees
  *Heater:* Turning {{ states('switch.kids_room_heater') }}

results in the following, which is correct:

ae986ac2d30994d0aee3b5282abfb1e3

:face_with_monocle:

1 Like

Yep you said that but also gave other suggestions which didn’t work. I was reaffirming that’s what it was, but evidently wasn’t enough :man_shrugging:

Hi I also can’t see the bold text on the telegram bot. I tried putting this code in the developer section but it doesn’t seem to interpret the characters.

action: notify.frefrere
data:
  message: >
    *Maintain Room Temp (Night)*

Try double asterisks.

action: notify.frefrere
data:
  message: >
    **Maintain Room Temp (Night)**

or

      message: >-
         <b>xxx</b>

P.S: settings for telegram bot:

telegram_bot:
  - platform: polling
    api_key: !secret telegram_token
    parse_mode: html 
    ...

BTW, with “asterisks” I see no style applied (top to down - with “b”, w/o, with “asterisks”):

Perhaps depends on “parse_mode”.

i have solved with html tag

<b> text</b>