Guys, I’m trying to create a flow in my n8n together with the typebot.
In the typebot I created a flow with a webhook that sends the response for the n8n to send to an AI assistant in the gpt chat through the node and in the end the respond to webhook node sends the message to the typebot.
In the typebot flow panel I see that the response from the n8n arrives with several invalid characters, so to speak, but the message is not displayed to the user in the chat, below is a part of the message.
The services offered by Digicom IA are:\n\n- Strategic Planning in Digital Communication \n- Online Crisis Management \n- Digital Content Production \n-,
After the AI assistant node, I added the edit fields node, with the manual mapping configuration
name output, which takes the assistant’s response and the following code {{ $json.output.replaceAll(‘\n’, ‘\n’) }}
The result in the edit fields message comes out correctly as below, without the characters.
Strategic Planning in Digital Communication
- Online Crisis Management
- Digital Content Production
- Data Reading for Management
In the output, the characters are returned, as if they had not been processed, and this information goes to the respond to webhook.
I believe that this format is preventing the typebot from displaying the message.
How to fix it?
Hey @Digicom hope all is well, welcome to the community.
Looking at the following expression{{ $json.output.replaceAll(‘\n’, ‘\n’) }}
, I’d argue this code doesn’t actually change anything, because it replaces a newline character with… well, itself.
Just to see it for myself, I just registered an account and created a simple chat flow in typebot and connected it to the n8n workflow, which has a webhook connected to the AI Agent and responds when the answer is received.
The following is how the model responded:
[ { "output": "A fan of Game of Thrones!\n\nThere are a few notable individuals named John Snow in movies and TV shows, but I'll provide information on the most well-known one:\n\n**Jon Snow (not just "John Snow")**\n\n* Played by: Kit Harington\n* Character: The main protagonist of the HBO series Game of Thrones (2011-2019)\n* Based on: A character from George R.R. Martin's book series A Song of Ice and Fire\n\nHowever, if you're referring to a different movie or context, please provide more information or clarify which "John Snow" you're interested in.\n\nHere are some additional details:\n\n* Game of Thrones (TV series):\n + Release date: April 17, 2011\n + Number of seasons: 8\n + Genre: Fantasy, Drama\n + Awards: Won numerous awards, including a record-breaking 38 Primetime Emmy Awards\n* Jon Snow's character:\n + A bastard son of Ned Stark, the Warden of the North\n + Known for his honor, loyalty, and leadership skills\n\nLet me know if you need more information or have specific questions about John Snow/ Jon Snow!" } ]
(sorry to GOT fans for misspelling Jon’s name ¯\_ (ツ) _/¯).
As you can see a bunch of '\n’s, but here is how it comes out in the chat:
All ‘\n’ became actual new lines.
Good afternoon, how did you get the response from your flow in n8n to be displayed in the chat? In the typebot flow panel I see that I receive the response, but it is not displayed in my chat.