Loop Over Items does not seem to be looping

Hey there, i’ve began studying n8n recently and I am trying to make an automation to answer WhatsApp messages using AI. The issue here is that when the message is too large (has more than one paragraph) i want the answer to be broken into different messages, and I have been trying to achieve this using the Loop Over Items node, but it does seem to be sending only the first message. Could someone help me understand what exactly is wrong with this routine?

There is no apparent error message appearing, the loop just seems to stop after the first iteration.

The following is a sample json output sent by the code node to break the Text into paragraphs, in my tests, the same json is received as an input into the Loop Over node, but the Output is the first paragraph only.

[
  {
    "paragraph":  "Claro! Aqui estão as opções de cursos de mergulho que oferecemos:"
  },
  {
    "paragraph": "1. **Curso Open Water**: Ideal para iniciantes! Com este curso, você aprenderá a mergulhar até 18 metros de profundidade em até 3 dias, recebendo um certificado internacional ao final. O investimento é de R$1200."
  },
  {
    "paragraph": "2. **Curso Advanced Open Water**: Para quem já tem alguma experiência, este curso permite que você mergulhe até 40 metros de profundidade. É realizado em até 5 dias e também oferece um certificado internacional. O preço é de R$1600."
  },
  {
    "paragraph": "Se você estiver buscando algo mais introdutório, temos também o **Batismo de Mergulho**, que é uma experiência única para quem nunca mergulhou antes. Ele é guiado por um instrutor e custa R$360, incluindo 5 fotos subaquáticas."
  },
  {
    "paragraph": "Tem alguma dúvida ou gostaria de mais informações sobre algum desses cursos? 🌊😊"
  }
]

Information on your n8n setup

  • n8n version: 1.97.1
  • Database: Simple Memory (for now)
  • n8n EXECUTIONS_PROCESS setting: default, did not fiddle with this
  • Running n8n via: n8n cloud/dashboard
  • Operating system: Windows 10

You need to connect the output of the last node back into the input of the loop node for it to continue looping.

2 Likes

Hey @jessghostly,

I feel so dumb as I tried this before and it had not worked, only for me to notice the “Reset” toggle on the Loop was ON the entire time :frowning:

It has worked, thanks for the fast reply and the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.