How to Split ChatGPT Output into 30 Separate Lines in Make?

Hi everyone,
I’m working on a Make scenario that uses the OpenAI ChatGPT module to generate 30 LinkedIn post hooks (one per line). The model returns the hooks as plain text, each on a new line (no numbering or formatting), like this:
Hook 1
Hook 2
Hook 3

Hook 30

I need to split this output so that each individual hook can be processed separately in the next module (e.g., Airtable Create a Record — one row per hook).

What’s the best way to split this text into an array of 30 items, one per line, so I can iterate over them? I’ve tried using the Iterator module with a split function, but I’m not sure how to format it correctly.

Any help or example setups would be really appreciated!

Thanks in advance :raising_hands:

PS: here is the formula I used: split(trim({{5.choices.message.content}}); “\n”)

Hey Patrick,

you need to have a repeating unique identifier at the beginning or end of each item to use the split() function. Let’s say you have the Hook word only in those places. Then it would be

{{split("input"; "Hook")}}

Maybe you can tell ChatGPT to separate them with something unique that is not present in the text it self.

Thx Stoyan!
I will try and let you know if it works!

Welcome to the Make Community!

If your delimiter is a newline then you can just use the special variable newline.

{{ split(1.result; newline) }}

Hope this helps! Let me know if there are any further questions or issues.

@samliew

Thx!
It didn’t work, but I’ll find out using a parse Json.
Thanks again!