Encoding characters breaking integration

Hi

So, I have Perplexity passing content which contains \n line breaks. The output of which I need to pass in a POST HTTP request and the \n is breaking the request. I have created a Text Parser module that replaces {{newline}} with urlencode(
) but the output still breaks. The
is replaced with %0A which is breaking the POST request.

What is the best way to get the content out of Perplexity and into the request?

[
{
“text”: “After conducting research on the internet, I found the following information about Steve Jenkin:\n\nSteve Jenkin has no recorded history of arrests or convictions. There are no sanctions imposed on him by any government or international organization. He is not listed as a Politically Exposed Person (PEP) by any reputable source.\n\nSources used for this research include:\n\n* Thomson Reuters World-Check\n* Dow Jones Risk & Compliance\n* LexisNexis Risk Solutions\n* Bloomberg Government\n* Financial Action Task Force (FATF) database\n* United Nations Al-Qaeda Sanctions List\n* European Union’s list of persons, groups and entities subject to EU financial sanctions\n\nPlease note that this research is based on publicly available information and may not be exhaustive or up-to-date. Additionally, the absence of any adverse media recorded against Steve Jenkin does not guarantee that he is not involved in any illegal or unethical activities.”,
“value”: “%0A”,
“global”: true,
“pattern”: “\n”,
“multiline”: true,
“sensitive”: false,
“singleline”: false
}
]

Output

[
{
“text”: “After conducting research on the internet, I found the following information about Steve Jenkin:%0A%0ASteve Jenkin has no recorded history of arrests or convictions. There are no sanctions imposed on him by any government or international organization. He is not listed as a Politically Exposed Person (PEP) by any reputable source.%0A%0ASources used for this research include:%0A%0A* Thomson Reuters World-Check%0A* Dow Jones Risk & Compliance%0A* LexisNexis Risk Solutions%0A* Bloomberg Government%0A* Financial Action Task Force (FATF) database%0A* United Nations Al-Qaeda Sanctions List%0A* European Union’s list of persons, groups and entities subject to EU financial sanctions%0A%0APlease note that this research is based on publicly available information and may not be exhaustive or up-to-date. Additionally, the absence of any adverse media recorded against Steve Jenkin does not guarantee that he is not involved in any illegal or unethical activities.”
}
]

I wouldn’t use the parse text module here this is easy enough to use the replace function.

just use replace(text;/n;emptystring)

Good luck,
Mr. Make

But I need to replace it with <br> and also replace ‘&’

image

Your function should look like this. This replace \n with < br > and & with < br > change that if you need to. But something is off with what you just sent it shouldn’t end with "}}. Try just re writing it to copy what I did. @crm_automator

Ok I will try :slight_smile: thanks

The }} is this POST call

https:///rest.php?method=set_entry&input_type=JSON&response_type=JSON&rest_data={“session”:“{{67.data.id}}”,“module_name”:“Leads”,“name_value_list”:{“id”:“{{41.id}}”,“adverse_media_c”:“{{replace(66.choices.message.content; “\n”; “
”)}}”}}

Ok i have it working thanks to you @Mr.Make !! much appreciated

I did what you said but just also encoded the url for the BR break and used the newline variable.

image

3 Likes

Awesome! If this solution helped, could you please mark it as the accepted answer. This way, others can find the solution more easily. @crm_automator

Have a great day, and I’m glad I could assist you!

1 Like