// Generate message per movie
for (const item of $input.all()) {
item.json.message = `${item.json.appended_title[0]} - IMDB: ${item.json.ratings_imdb_value} | RP: ${item.json.ratings_rottenTomatoes_value}`;
}
// Put everything together
const wholeMessage = `Movie List:
${$input.all().map(item => `- ${item.json.message}`).join('\n')}`;
return [
{
'message': wholeMessage
}
]
This code schould actually work. But it seems that n8n may not render the string correctly in the output area. Try to send it to telegram. maybe it is working as expected.
Yeah, the solution of @donniedarkowindsalt is very good too. I will use it because it’s easier and very simple to use. Then I will save your code too for future use.