I am getting a response from OpenAI and trying to create a slack message. The response is in multiple lines and this breaks the slack JSON.
What is the best way to make this work
I am getting a response from OpenAI and trying to create a slack message. The response is in multiple lines and this breaks the slack JSON.
What is the best way to make this work
Quick and dirty would be to replace every newline with an emptystring
like this:
Copy past to sceanrio:
{{replace(1.text; newline; emptystring)}}
Ha that is where i have been going wrong. I have been trying to use \n
… Do you know where i can see a list of these variables like newline
and emptystring
I tried this as well to no avail
{{replace(2.choices[].message.content; "/\n/gmi"; "")}}
Only those are available to be replaced.
FYI this seems to get the job done
{{replace(decodeURL(replace(encodeURL(2.choices[].message.content); "%0A"; "\n")); "\""; )}}
Hey @Tech_Bpeneur
I just wanted to quickly step in and say awesome work figuring this out with the help of @Levin
And thanks a lot for circling back to the community and letting us know what did the trick for you. This is super valuable stuff and we all 100% appreciate it
Just FYI: I marked your reply as a solution so that folks who are searching for similar info in the future know where to look
@Michaela this may be a slightly better solution
{{decodeURL(
replace(
replace(
encodeURL(2.choices[].message.content);
"%0A"; "\n"
);
"%22"; emptystring
)
)}}