Telegram markdown (parse_mode) / emoticons

I am digging deeper into automation and templating. Sending simple messages with automation over Telegram is already working. From node-red I know, that you can easily use markdown and emoticons in the messages.

But with the following automation I got plain text instead of bold:

- alias: 'Telegram Commands'
  hide_entity: true
  trigger:
    platform: event
    event_type: telegram_command
  action:
    - service: notify.telegram
      data_template:
        message: >
          {% if trigger.event.data.command == '/ping' %}
            pong
          {% else %}
            **command not found**
          {% endif %}

I tried to add the parse_mode: markdown to the data_template but that causes an error. Also I tried to put the parse_mode directly to the telegram_bot service. That has no effect at all.

Second question: is there an easy way to integrate emoticons? Just copy them from telegram to the message (like in node-red) causes format errors because of special characters (I also red about this issue in other threads).

Okay I have a solution for the first issue. It is no ‘real’ markdown as described for example here.

I thought it has to be **text** for bold and *text* for italic. In fact you can use *text* for bold and _text_ for italic. Strange…

Example (from documentation):

action:
  service: notify.NOTIFIER_NAME
  data:
    title: '*Send a message*'
    message: "That's an example that _sends_ a *formatted* message with a custom inline keyboard."
    data:
      inline_keyboard:
        - 'Task 1:/command1, Task 2:/command2'
        - 'Task 3:/command3, Task 4:/command4'

Help for the emoticon-issue is still welcome.

1 Like