Ask AI
Skip to main content

Connect to ftp

Function: Connect to FTP

This action allows your application to establish a secure connection to an FTP (File Transfer Protocol) or SFTP (Secure File Transfer Protocol) server. Once connected, you can perform various operations like listing files, uploading, or downloading data from the remote server. This is essential for integrating your application with external systems that store or exchange files via FTP/SFTP.

Input

  • Protocol (Required, Default: SFTP):
    • Type: Selection from a dropdown.
    • Description: Choose the secure protocol for your connection.
    • Options:
      • SFTP: Secure File Transfer Protocol (recommended for most secure connections).
      • FTPS: FTP Secure (FTP over SSL/TLS).
  • Authentication (Required, Default: USERNAME_PASSWORD):
    • Type: Selection from a dropdown.
    • Description: Select how you want to prove your identity to the remote server.
    • Options:
      • Use a username & password to authenticate: Standard authentication method.
      • Use a public & private key to authenticate: A more secure method often used with SFTP.
  • Username (Optional):
    • Type: Text.
    • Description: The username required to log in to the FTP/SFTP server.
  • Password (Optional):
    • Type: Password.
    • Description: The password associated with the username. This is required if "Use a username & password to authenticate" is selected.
  • Private key (Optional):
    • Type: Password.
    • Description: The private key content (usually Base64 encoded) used for authentication. This is required if "Use a public & private key to authenticate" is selected.
  • Remote host (Required):
    • Type: Text.
    • Description: The address or hostname of the FTP/SFTP server (e.g., ftp.example.com or 192.168.1.1).
  • Port (Optional):
    • Type: Number.
    • Description: The port number to use for the connection. The default port for SFTP is typically 22, and for FTPS it can vary (e.g., 21 for control, 990 for implicit SSL).
  • Remote directory (Optional):
    • Type: Text.
    • Description: An optional starting directory on the remote server. If left empty, it will connect to the root or default directory for the user.

Output

  • Folder to read (Default variable name: FTP_FOLDER):
    • Type: Folder.
    • Description: A reference to the connected remote folder. This output can be used by subsequent actions to interact with files and subfolders on the FTP/SFTP server.
  • The status (Default variable name: FTP_STATUS):
    • Type: Status.
    • Description: Indicates the outcome of the connection attempt. It will be "SUCCESS" if the connection is established, or "CONNECTION_FAILED" if there was an issue.

Execution Flow

Real-Life Examples

Example 1: Connecting to an SFTP server with Username and Password

Imagine you need to regularly fetch sales reports from a partner's SFTP server.

  • Inputs:
    • Protocol: SFTP
    • Authentication: Use a username & password to authenticate
    • Username: sales_user
    • Password: MySecureP@ssw0rd
    • Remote host: sftp.partnercompany.com
    • Port: 22
    • Remote directory: /reports/daily
  • Result: The action successfully connects to sftp.partnercompany.com on port 22, specifically to the /reports/daily folder. The FTP_FOLDER variable now holds a reference to this remote directory, allowing subsequent actions to list or download files from it. The FTP_STATUS variable is set to "SUCCESS".

Example 2: Connecting to an FTPS server to upload marketing materials

Your marketing team needs to upload new campaign images to a secure FTPS server.

  • Inputs:
    • Protocol: FTPS
    • Authentication: Use a username & password to authenticate
    • Username: marketing_uploader
    • Password: CampaignUpload!2023
    • Remote host: ftps.marketingassets.net
    • Port: (Leave empty, system might use default or you can specify 990)
    • Remote directory: /campaigns/new_images
  • Result: The application establishes a secure FTPS connection to ftps.marketingassets.net and navigates to the /campaigns/new_images directory. The FTP_FOLDER variable is ready for actions like uploading files, and FTP_STATUS is "SUCCESS".

Example 3: Connecting to an SFTP server using a Private Key for automated data sync

You have an automated process that syncs customer data with an external system via SFTP, using a highly secure private key for authentication.

  • Inputs:
    • Protocol: SFTP
    • Authentication: Use a public & private key to authenticate
    • Username: data_sync_bot
    • Private key: -----BEGIN RSA PRIVATE KEY-----\n... \(your base64 encoded private key content\) ...\n-----END RSA PRIVATE KEY-----
    • Remote host: sftp.externaldata.org
    • Port: 22
    • Remote directory: /customer_data/inbound
  • Result: The action securely connects to sftp.externaldata.org using the provided username and private key, pointing to the /customer_data/inbound folder. The FTP_FOLDER variable is now available for further file operations, and FTP_STATUS is "SUCCESS".