Skip to content

Fetch and Store Remote File

This Step helps save a publicly available file to Files. After you have uploaded the file, you can use it further in the Flow via the Merge field.

How does the Step work?

You provide the file URL and define its status, name, and path. When the Flow reaches the Step, it uploads the file to Files and adds the information about its name, size, extension, and URL to the output. To store a file in another OneReach.ai account, use Cross-account settings.

TIP

This Step is not intended to fetch files stored on FTP/SFTP servers or cloud services like Google Drive, OneDrive, etc.

TIP

Uploading a big-sized file may take some time. Make sure to take this into account while building your Flow.

Prerequisites

To access another OneReach.ai account, make sure you meet the following requirements:

  • Your account has the Super Admin role.
  • Your Flow has the Super Admin flow permission level.
  • You have an Account ID, or User or Flow Authentication token related to the OneReach.ai account you want to access.

File settings

In this section, you define the uploaded file, its path, name, status, and, optionally, how long it will be stored.

The Files service limits the size of the file path to 1024B, which is equivalent to 1024 Unicode UTF-8 characters. However, Files has to reserve up to 124 characters. Therefore, the length of the defined file path in the Step, including the file name and extension, should not exceed 900 characters.

To set up this section, define the following inputs:

  • File URL or base64 string is the link to the uploaded file set as URL or in the base64 string format.
  • File name should be defined without an extension or left empty to keep the original name.
  • Folder is where the uploaded file will be stored in your Files.
  • File status of the uploaded file that can be later changed
  • Set auto-delete time is optional and allows setting a period after which the uploaded file is deleted.

File URL or base64 string

The URL to the uploaded file must begin with http:\ or https:\ and end with the filename and extension.

TIP

If the uploaded file contains an image, a preview of the image will show up under the File URL or base64 string field.

Alternatively, you can provide the file in the base64 string format, which is expected, for example, as data:image/jpeg;base64,/....

Folder

To upload the file to an existing folder within Files, click Select folder, then choose the folder in the popup window.

Alternatively, the folder can be defined in the folder field in the foldername/ format. Use / as the divider. If the defined path doesn’t exist, it will be created.

TIP

Enter the / character to upload the file to the root folder.

TIP

If a file with the defined name, extension, and path already exists, it will be overwritten.

Auto-delete time

By default, the uploaded file will be stored in Files indefinitely. To limit the file's time to live (TTL) value, turn on the Set auto-delete time toggle, then define the TTL in the Delete file after field. After the Step has been executed and the set amount of time passes, the file is deleted from Files. TTL limits are between 1min and 365d. Here are examples of acceptable time formats: 1 week, 115h, or 5 min 30 sec.

WARNING

The file URL with expired TTL stays active for up to 5 min.

Cross-account settings

By default, you can upload a file only to your OneReach.ai account. To upload a file from to different OneReach.ai account, do the following:

  1. Make sure that your OneReach.ai account has the Super Admin role. To check your role, go to the Action desk -> Users. The role is defined under the name of the user. If the role isn’t Super Admin, reach out to OneReach.ai support to change it.
  2. Go to the General tab of the Flow, then open Deployment settings -> Flow permissions level and select Super Admin. Turn on the Use custom authentication token toggle.
  3. Choose one of the access types and provide respective data:
  • For the Authentication token type, select the USER or FLOW type and provide the respective token. Please, reach out to OneReach.ai support to obtain the value for this token.
  • For the Account ID type, provide the Account ID of the user you wish to access. The Account ID value is a unique UUID v4 format string value generated for each OneReach.ai account. An option to Copy account ID can be found in the Profile settings of the OneReach.ai window under the Current account label.
  1. Save and activate the Flow.

Merge field settings

The Step returns the result as a JSON object and stores it in the Merge field. To learn more about Merge fields, their types, and how to work with them, follow this link.

Output example

The Step’s output includes the following properties:

KeyTypeDescription
urlStringThe link to the uploaded file in Files.
sizeNumberThe size of the uploaded file in bytes.
nameStringThe file name of the uploaded file.
extensionStringThe file type and extension in type/extension format.
ttlNumberThe auto-delete date of the uploaded file in timestamp format.

See below an example of the Merge field object’s structure:

JSON
{
  "url": "https://files.staging.api.onereach.ai/public/6d35064f-e424-42fe-9e97-145e4e3f72kb/4b91a186-152g-46eb-dr0d-1a8eb355e8d3/image.jpeg",
  "size": 50482,
  "name": "image.jpeg",
  "extension": "image/jpeg",
  "ttl": 1681300119268
}
{
  "url": "https://files.staging.api.onereach.ai/public/6d35064f-e424-42fe-9e97-145e4e3f72kb/4b91a186-152g-46eb-dr0d-1a8eb355e8d3/image.jpeg",
  "size": 50482,
  "name": "image.jpeg",
  "extension": "image/jpeg",
  "ttl": 1681300119268
}

Error handling

By default, the Step handles errors using a separate exit. If an error occurs during the Step execution, the Flow proceeds down the error exit, e.g., if the File URL does not lead to a file. For more information on error handling, follow this link.

Reporting

The Step automatically generates Reporting events during its execution, allowing for real-time tracking and analysis of its performance and user interactions. To learn more about Reporting events, follow this link.