You can use files in workflows by passing the file links between steps. By default, links to files that are the output of step executions can only be used in Torq steps. This means the file links can't be opened in a browser or shared with external services. There is an option to make the file link shareable.
Here are some common ways to use files in workflows:
File attachment for an IMAP trigger
Important to Know
The format for links to files that are outputs of step executions:
tqfile://steps/XXXXXXX
File links can't be shared externally. They can only be passed in Torq steps using the inline function file.
Example:{{ file $.send_an_http_request.api_object.url }}
Other file links are signed URLs with this format:
https://link.torq.io/****dEjnLCXnv7
. These file links can be shared externally and used in Torq steps without using the inline function file.
Supported Steps
You can return the response as a file for the following steps:
Send an HTTP request
Any step that you can switch to HTTP mode
Share a File Outside of Torq
These instructions explain how to get a signed URL for a file stored in Torq to share outside Torq. Files will be available for 24 hours and then deleted. To change the expiration period, contact Torq support.
In the step Execution Options section, set the Return response as file toggle to Yes.
Set the Shareable link toggle to Yes.
Example Use Case
This example shows how to use a non-sharable file URL in a subsequent step.
Add the step Send an HTTP request step to the canvas.
Under Execution Options, set the Return response as file toggle to Yes.
Run the step. The file URL appears in the following format -
tqfile://steps/XXXXXX
and is available in the step output in the Execution Log. The file URL can only be used in Torq steps.To extract data from the file, use this expression
{{ file $.send_an_http_request.api_object.url }}
Use Files in Inline Scripts
To access the content of a file in an inline script, you first need to apply the Get method to the file URL.
The example below shows a Python inline script, but the same applies to other scripting languages, such as Javascript, Bash, etc.
Use the file inline function for non-shareable file URLs that have the format: tqfile://steps/XXXXXX
Shareable URLs that don't require the file inline function: https://link.torq.io/***dEjnLCXncv7
Upload a File Using an HTTP Request Step
Add a Send an HTTP request step to the designer.
Set the METHOD to POST.
Add a header to the HEADERS section if you want the file to be interpreted in a specific format (for example, to suit the third-party service requirements).
Key: content-type
Value: file format
Set the body CONTENT_TYPE parameter to raw binary.
Set the BODY to the file URL. For example,
{{ file $.prev_step_name.api_object.url }}
. Use the file inline function for non-shareable links.