Combining two data from two flows / two triggers

HI,

I’ve got a chat workflow that has two triggers (Telegram and Twilio/Whatsapp). I want to extract some key fields from these triggers and combine them into a single data object I can later refer to in my flow…

From my research it seems I need to use a code node for this with an if clause to check which tigger kicked off the flow, and then map the relevant data fields to a new json object which I can then refer to in follow-on nodes.

Does that sound about right? Can anyone point me to an example that would show me what the the javascript code in the code node would roughtly look like?

Thanks a lot!