Unicode in telegram notify message

Hi,

I’m trying to use emoji in telegram messages but i don’t find the correct syntax to do that.

I have tried (without result):

  • \u1F512
  • \u1F512
  • 🔴
  • :red_circle:

what should be the correct syntax?

Thanks!

I get it using unicode format like this:

message: “\U0001F420 BLABLABLABLA”

You can find the codes here:
http://unicode.org/emoji/charts/full-emoji-list.html

This works fine for me when using it in an automation like this

  action:
    - service: notify.telegram
      data:
        message: "\U00002714 Here goes my message"

but I cannot get it to work when using a data template

  action:
    - service: notify.telegrambot
      data_template:
        message: 'Here goes my message'

I’ve tried using ’ and " and whatever stuff ({{}}, UTF-16 etc) mentioned in Emojis in iOS notifications - #12 by patfelst.

Ideas?

1 Like

dosen’t look like i’m able to do that even in automations…

  action:
  - data:
      message: 'Drin - Drin! \U0001F514'

not working

edit: actually, it works but only at the beginning of the string.

  action:
  - data:
      message: '\U0001F514 Drin - Drin!'
1 Like

A think to open an issue about this it would be a good idea.

Did you find a solution to send unicode emjis in templates?

I’ve tested this and ist seems to be working:

service: notify.telegram
data:
  message: "\uD83D\uDD0C Power cord is not plugged! \uD83D\uDE14"

This works:

  - service: notify.admin_group
    data:
      message: >
        {%- if trigger.to_state.state == 'armed_away' -%}
          {{ "Alarm is armed (away) \U0001F534" }}
        {%- elif trigger.to_state.state == 'armed_home' -%}
          {{ "Alarm is armed (home) \U0001F7E1" }}
        {%- elif trigger.to_state.state == 'disarmed' -%}
          {{ "Alarm is disarmed \U0001F7E9" }}
        {%- elif trigger.to_state.state == 'arming' -%}
          {{ "Alarm is arming \U0001F7E8" }}
        {%- else %}
          {{ "Alarm is *{{ trigger.to_state.state }}*" }}
        {%- endif -%}