# Escaping / in Telegram message

**URL:** <https://discourse.nodered.org/t/escaping-in-telegram-message/26771>\
**Category:** General\
**Created:** [16 May 2020 19:55 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771 "2020-05-16T19:55:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [16 May 2020 19:55 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/1 "2020-05-16T19:55:17Z")

</div>

Hello,

Some of my messages contain text with is preceded by a slash. The telegram-bot parses that into a blue, clickable command :

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/3/633f6f8becf95ae6da94e413ffe9e49ab49d67ec.png)

Any idea what the best way is to escape this?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [17 May 2020 06:02 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/2 "2020-05-17T06:02:20Z")

</div>

If it is html text, perhaps you could try: `&#47;`

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [17 May 2020 09:21 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/3 "2020-05-17T09:21:12Z")

</div>

Thanks for your reply, but I'n using parsing mode MarkdownV2, not HTML

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [17 May 2020 09:31 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/4 "2020-05-17T09:31:49Z")

</div>

Then try to escape it with a backslash, eg. `\/`

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [17 May 2020 11:55 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/5 "2020-05-17T11:55:10Z")

</div>

.replace(///g, "\/") doesn't seem to do the trick, it still gets displayed unchanged.

Any further suggestions?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 May 2020 12:45 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/6 "2020-05-17T12:45:34Z")

</div>

Having escaped it with backslash did the backslash appear as a character? If not did you check that the backslash was really there in the sent message?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [17 May 2020 12:45 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/7 "2020-05-17T12:45:36Z")

</div>

Yes, use html instead ?

Dont think it is possible see questions around telegram + markdown + escaping (google)

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [17 May 2020 12:52 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/8 "2020-05-17T12:52:52Z")

</div>

Colin I don't really get what you mean. Before and after escaping doesn't make any difference. My input message contains a /slash and my output message still gets treated as a command, which it isn't. It's just like I would send a message containing "Do you like this feature yes/no" and the /no becomes clickable as if it is a command.

The only "but" in this case is that my message contains the text "berm-/ruigte" so maybe the - prior to the slash causes the issue. As workaround I could replace "-/" by "/" which probably should solve this particular case, but overall I was wondering if this command feature could be disabled somehow... If not I should probably have to deal with it...

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 May 2020 12:57 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/9 "2020-05-17T12:57:28Z")

</div>

Did you check that, having done the replace, the text you were sending was `berm-\/ruigte`?

**[Edit]** Might also be worth trying `berm\-/ruigte`

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [17 May 2020 13:35 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/10 "2020-05-17T13:35:01Z")

</div>

For now, this solves the issue for me; replace(/-//g, "/")

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 May 2020 14:16 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/11 "2020-05-17T14:16:37Z")

</div>

For those that come hereafter it might be useful if you said whether escaping the - did anything.

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [17 May 2020 14:29 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/12 "2020-05-17T14:29:17Z")

</div>

That character was already escaped, otherwise my payload would not be accepted by the Telegram-bot : replace(/-/g, "\-")

But that doesn't solve anything, since that line was already present before I posted my issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 May 2020 14:29 UTC](https://discourse.nodered.org/t/escaping-in-telegram-message/26771/13 "2020-05-31T14:29:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
