how to do conditional robots

Archived from the Transloadit support forum. Originally posted on April 9, 2012; details may be outdated, see our docs for current behavior. Original thread

I want to have my transcoding job optionally export out to a second s3 bucket if a variable or parameter is passed in. I was thinking of passing in a whole extra export step based on client-side logic in as a param but didn’t want to store the s3 secret in the client side. I could stub out the extra import step in my template and use the params merged in from the client to somehow activate it, but the export robot won’t take an empty “use” parameter to start.

How can I either execute a step conditionally based on a param, or if I have to use the param merged from the client to do this, how can I keep some secret variables in the server template. I tried the “fields” property but that didn’t seem to work.

Hey Mike,

good question.

One thing to do this is to make sure the specific step does not take on any files if it’s not meant to be executed.

So you could have your extra export step in your template with all credentials and settings, and then “use” another step that contains your condition - for example a /file/filter step. In the /file/filter step you could test for a field that you passed from the outside like so: ${fields.yourVar} < “something”.

Let me know if this helps.

ah, yes the file/filter step would work, thanks.

Closing this