Hope this helps…
So when the file gets added and uppy fires the “file-added” event, listen for it and push any custom meta data you want into the uppy file object by calling setFileMeta like below
uppy.on('file-added', file => {
uppy.setFileMeta(file.id, {
myCustomVarName: myCustomVarValue,
myCustomVar2Name: myCustomVar2Value,
})
})
Then use the getAssemblyOptions callback to push your custom meta data into the “fields” key. By doing this, these same fields will be passed back in the request transloadit makes to your “notify_url” end point (see “notify_url” key specified below) when it has completed processing.
uppy.use(Transloadit, {
getAssemblyOptions(file) {
const {
meta: { myCustomVarName, myCustomVar2Name }
} = file
return new Promise((resolve, reject) => {
resolve({
fields: {
myCustomVarName,
myCustomVar2Name
},
params: {
auth: { key: process.env.REACT_APP_TRANSLOADIT_AUTH_KEY },
notify_url: process.env.REACT_APP_TRANSLOADIT_NOTIFY_URL,
steps: {
thumbnail: {
robot: '/image/resize',
use: ':original',
width: '50',
height: '50'
},
fullsize: {
robot: '/image/resize',
use: ':original',
width: '320',
height: '1000'
},
export: {
use: [':original', 'fullsize', 'thumbnail'],
robot: '/s3/store',
key: process.env.REACT_APP_AWS_ACCESS_KEY,
secret: process.env.REACT_APP_AWS_SECRET_KEY,
bucket: 'my-bucket-name,
// See https://transloadit.com/docs/#22-assembly-variables for available assembly variables
path: `\$\{previous_step.name\}.\$\{file.ext\}`
}
}
}
})
})
},
service: 'https://api2.transloadit.com',
waitForEncoding: false,
waitForMetadata: false,
importFromUploadURLs: false,
alwaysRunAssembly: true,
signature: null,
limit: 10
})