Hello everyone, I hope you are doing well. My name is Samar, and I need help with n8n. I am working on building a workflow where I want to separate one big message into 2 or 3 smaller messages.
For example, if the n8n agent generates a response containing two or three lines, I want to split it into 2 or 3 separate messages and send them back to the customer.
So, letâs assume your agent output a single message, meaning one item, and you want to split it into 3 messages (items) so they can be sent separately.
In this case, you can use a code trick: take the message (1 item) and split it into 3 items, for example by using the positions of the dots in the text.
It is also possible to ask AI Agent to break the answer into sentences and format the output to be a json array with objects, where the key is âoutputâ and the value is each next sentence, then you would only need to split out the AI Agent response with split out node. Just a thought.
@mohamed3nan@jabbson Thank you for your responses. I will test it out both ways. Quick question: how can I use a wait function to send the second and third messages after 2 or 3 second? I donât want to send all the messages at the same time â I want to use wait. Looking forward to your response.
If I was trying to do it, after splitting the responses, I would probably create a loop, to loop over items, where I would add a wait node, then the send message node and loop back to the loop over items node.
If you have 5 minutes, we can jump on a Zoom call to do it, or you can share a Loom video with me. To be honest, I am building my first workflow in n8n and I donât know the best way to use the Split Out and SplitInBatches nodes. I would really appreciate your help. @jabbson
Hmm, this is interesting!
I think the loop wasnât a good approach here, I just realized itâs a webhook.
Since youâre getting the response output and processing it in ManyChat, you can simply remove the loop node and connect the codenode directly to the Respond to Webhook
Then, in your other ManyChat workflow, parse the webhook response (array of outputs)..
@mohamed3nan Thank you for your response. Could you please guide me on how to âparse the webhook response [array of outputs]â in a ManyChat workflow?