Not Interpret special characters

#1

Is there any way to get your system to NOT interpret special characters. For example, I bring in data via a custom request in json with a \n the data to signify a new line. You interpret that and display the new line in messages. That’s great, but I can’t figure out how to tell you not to do that. I wrote some javascript code to replace \n with \n so that the \n comes through as text, but you still interpret it. The problem is that when I pass json via webhook, there’s an error because you pass the data with a new line in there instead of with the \n.

e.g., instead of passing:
{“message”:“hi have a great day.\nyou’re great”}

you pass:

{“message”:“hi have a great day.
you’re great”}

And that causes a 400 in the post request

Thank you

(Daniel Beckett) #2

Hi @candle

Just to clarify, is this problem when sending the webhook out of FLG via a webhook & HTTP request? What type of method and content is being used?

#3

Post
application/json

As an FYI, if I type the \n in the FlowXO step, then you do pass the \n as part of the string in the api request, just like this and all is good: {“message”:“hi have a great day.\nyou’re great”}

But if the \n is in a string passed in from a different step, then you interpret it before making the api request. This is actually quite a pain - it makes it really annoying to store our data in our database (where we’re pulling the data from into flowxo) because I need to have a separate field for every string i want to be on a separate line so that i can make these api request outside flowxo. For example, my api request step looks like this:

{“message”:"{{http_request_data__messages_1}}\n{{http_request_data__messages__2}}\n{{http_request_data__messages__3}}\n{{http_request_data__messages__4}}"}

Instead of

{“message”:"{{http_request_data__message}}"}

Which is what it should be and the \n’s are all in that one message

(Daniel Beckett) #4

You could perhaps use the Text service to replace the text as it hits the Flow and then reformat it before sending it to your database.

#5

Tried it. Also tried doing the same thing with code; didn’t work; neither option.

(Daniel Beckett) #6

When you say it didn’t work do you mean that it didn’t remove"/n" from the block of text when you used the text service? Could I see an example of some incoming webhook data and the action you used to split the text?

Thanks,
Dan