Line breaks in a Telegram bot

(Vova Nest) #1

Hi team,

How can I replace “\n” (and other special characters) contained in a user input to my Telegram bot?

I tried using the Text service (scr attached), but it didn’t help – “\n”'s remain in the text and HTTP request returns a 400 error, msg: Illegal unquoted character ((CTRL-CHAR, code 10))

Thank you!

Attribute length limit?
(Daniel Beckett) #2

Karen’s post on the following page describes what input Telegram supports:

Hopefully that clarifies what can be used. :slight_smile:

(Vova Nest) #3

Thank you, Daniel.

So, i see br tags are not mentioned there by Karen. Meaning I can’t use that.

That is pretty sad, since I found this hack (replacing /n’s to br’s) somewhere in the community discussions and people seemed to be happy of it.

In that case, what would be the correct way to keep line breaks in the attribute value being sent via HTTP request, but at the same time to avoid the “Illegal unquoted character” error?

(Karen Barker) #4

Hi @vovanest,

The post above actually just covers what you can send in a message on Telegram. I think what you’re trying to do is actually a bit different from that.

From what I understand, you’re getting a message from a user on Telegram that has a line break in it and then wanting to send this to a 3rd party using a HTTP request? The HTTP request is then failing due to the html in the request?

I think you should be able to escape the \n by replacing it with \n - give it a try, :slight_smile:

(Vova Nest) #5

Thank you, @KarenBarker - that is exactly my use case. I am using the bot as an agent for crm, which is a 3rd party in my case. Unfortunately, the workover you’ve mentioned doesn’t help. See the respective interaction attached (note the first instance of “/n” in the output there - it happens all the time).

(Karen Barker) #6

Hi @vovanest

I think the best thing here might be if you can email us at support@flowxo.com and include a link to your flow with how to recreate the situation. Once I have a recreatable test case then I’ll be able to take a closer look at how to solve this.

Thanks :slight_smile:

(Alberttosanchez) #7

A workaround would be to use a FOR loop to send multiple messages. It appears separately.