Formatting Text Aggregator output

Hi there,

I’ve got a scenario that receives a new lead from Chatbase through a Webhook, then finds the conversation that the lead came from, and combines the lead details and the conversation log into a single email that gets sent to a sales rep via email. Looks a little like this (webhook replaced with scenario input and email replaced with a variable output to make testing easier):

I’m using a Text Aggregator to create the conversation log that goes into the email. Here’s what the data looks like that it’s aggregating from:

And here’s the aggregation formula:

It works in the sense that I get all the combined ‘content’, but it’s one long string.

Ideally I’d present it like this:

Role: assistant
Content: default initial message

Role: user
Content: The first user question

Role: assistant
Content: The first generated answer


So 1) Mapping both the role and the content of the message one after the other and 2) with an empty line between individual items.

I’ve tried using the Row Separator option in the Text Aggregator settings, but it does nothing. I can imagine I’d have to alter the modules before, but not sure how I’d approach this. Any idea?

If you want the text in the above format, first add an iterator for messages because ‘messages’ is the collection of an array. After that, you need to map values in the following format. If you want to send text in an email, you should use <br> tags instead of a newline.

For email you can use this format



Ah nice, that did it! Thanks so much :slight_smile: