Answered

How to insert a linebreak in a conversation attribute

  • 4 December 2023
  • 4 replies
  • 135 views

Hello,

I’m working on a workflow for a chatbot using an API. My issue is simple, this API is returning content from our API that I need to display on Intercom Messenger.

It’s working fine but with an issue: line breaking (\n) are ignored. I tried with <br /> but it wasn’t my best idea → the “<br />” will appear in the conversation. 

I checked the API response in the custom action log, the API is returning JSON as planed, with some \n or \n\n. They just disappear when the content is used in a message in Intercom Messenger. 

Any idea to fix this ?  

icon

Best answer by Jacob Cox 11 December 2023, 00:03

View original

4 replies

Userlevel 4
Badge +5

Hi @Alexandre Bougra 

 

I can confirm that this is a known behavior with Custom Actions / REST API at the moment. Submitted line breaks will not be respected when sent via a Custom Action or REST API call. Our team is aware that this isn’t ideal and is looking into it. Thanks for reaching out about that!

We are having the same issue. With “<br />” it looks great in the conversation attributes section, but shiows the “<br />” when sent through workflow. Is there any work around? How can we set info with multiple lines through the workflow?

I get why you're annoyed about line breaks not showing up right in Intercom Messenger when using API stuff. So, here's what you can do: first, try fixing it in your custom action before sending the message by changing "\n" to "<br>" tags. Or, if you can, use Markdown to format your text with line breaks. If your message is super long, you can split it into smaller ones using Intercom's message segmentation feature. Just make sure to test whatever you choose to do so it works right in Intercom Messenger.

Userlevel 4
Badge +5

Just a heads up that the team has now implemented the ability to create multiline attributes in Custom Actions!

Reply