Help using ComposeAPI.recordUpload() to attach files from an automation script

Hi there,

I have an automation script that with the following trigger:

triggers ({ on }) {
    return on('request')
      .where('request.path', '/incoming-mail') 
      .where('request.method', 'POST') 
      .for('system:sink') 
},

This script needs to parse an incoming email and then create CRM/Lead and Notes from the pased data. This part is working fine.

The part I’m struggling with is understanding how to attach files to the Notes using ComposeAPI.recordUpload().

file = await ComposeAPI.recordUpload({
     namespaceID: '248944301772570628',
     moduleID: '248944302124695556',
     recordID: note.recordID,
     fieldName: 'Files',
     upload: [what goes here???]
});

Any tips on how to prepare the file data for the “upload” parameter above would be very helpful

Thanks