Adding FTP Input to a Flow
With the ftp input node, you can use an FTP upload as a trigger for actions in your flow. While there are many ways you could use this functionality, one common use is to run TDE templates automatically when an input file is uploaded via FTP.
Using this node requires the following setup:
• | Assign at least one SFTP user to the flow. Multiple SFTP users can be assigned to a single flow, but each SFTP user can only be assigned to one flow at a time. |
• | Add an ftp input node to the flow to watch for FTP uploads from the SFTP user accounts assigned to the flow. |
• | Set up an SFTP connection using the SFTP client of your choice. To find the SFTP Hostname and Port required for this connection, click the down arrow to the right of the flow and select "Edit Secure FTP users". |
Assigning SFTP Users to a Flow
1. | From the Developer Console, click the down arrow to the right of the flow you want to edit, and select "Edit Secure FTP users". |
2. | From the Unassigned Secure FTP users drop-down menu, select the SFTP user to assign. |
3. | Click Assign to this flow. Any FTP uploads from this user’s credentials are now watched automatically by any ftp input nodes added to the flow. |
Sample Flow: Using FTP Input to Execute a TDE Template
After setting up SFTP users, you can add the ftp input node to your flows.
The example below shows how you can use the ftp input node to watch for an upload of a TDE input file, parse the CSV contents of the file into a JSON object, and then automatically run a TDE template with that data.
Keep in mind that the configuration options described below are setup to handle the test data provided in this sample. When implementing a similar flow, you likely need to adjust these options to meet the needs of your particular use case.
You must have TDE authentication credentials to execute this flow. |
1. | Create the sample flow: |
|
2. | Click the flow name (sftp) to open it in the Flow Editor. |
3. | From the Flow Editor, add and connect the following nodes: |
|
4. | Configure the ftp input node: |
|
5. | Configure the csv node: |
|
6. | Configure the tde template node: |
|
7. | Configure the debug node: |
|
8. | Deploy your flow. |
9. | Upload an input file by FTP: |
|
10. | View the results of the upload: |
|
The flow created in this tutorial is described by the JSON below. To successfully execute the flow, you must edit the tde template node Config to add your own TDE credentials before you deploy.
To import a flow into the Editor, copy the code provided, click the upper right ≡ Menu button, then select "Import" > "Clipboard". Paste the code in the Import nodes window, then click Import.
Code:
[
{
"id": "ab76f2dd.2c47d",
"type": "debug",
"z": "f9095e7d.e308d",
"name": "",
"active": true,
"console": "false",
"complete": "true",
"x": 650,
"y": 100,
"wires": []
},
{
"id": "ff9fae96.20f9a",
"type": "ftp-watcher",
"z": "f9095e7d.e308d",
"filename": "CreateDriver.*txt",
"useRegex": true,
"output": "contents",
"datatype": "utf8",
"x": 80,
"y": 100,
"wires": [
[
"c4e0a922.9042"
]
]
},
{
"id": "2fd834e.d26becc",
"type": "tde template",
"z": "f9095e7d.e308d",
"name": "",
"template": "[Template]\nTemplateVersion = 1.0\nTableID = Driver-1.0\nTemplateName = CreateDriver2\nIntent = Create\nCommit = False\nFormat = json\n\n[Output]\nId(BasicDriver) = Input.EmployeeNumber\nNickname = Input.FirstName || \" \" || Input.LastName\nSurname = Input.LastName\nFirstName = Input.FirstName\n",
"executeTemplateWithData": true,
"templateDataLocation": "payload",
"useMustacheTemplating": false,
"mustacheDataLocation": "__undefined__",
"templateMessageData": "",
"mustacheMessageData": "",
"outputDataLocation": "payload",
"useStreaming": false,
"config": "2cb5c1c2.26cc4e",
"x": 470,
"y": 100,
"wires": [
[
"ab76f2dd.2c47d"
]
]
},
{
"id": "c4e0a922.9042",
"type": "csv",
"z": "f9095e7d.e308d",
"name": "",
"sep": ",",
"firstRowContainsColumnNames": true,
"parse": true,
"outputColumnNameRow": true,
"sendMultipleMessages": "true",
"ret": "unix",
"x": 270,
"y": 100,
"wires": [
[
"2fd834e.d26becc"
]
]
},
{
"id": "2cb5c1c2.26cc4e",
"type": "api-config",
"z": "f9095e7d.e308d",
"proxy": "",
"instance": "production",
"custominstance": "",
"labelValue": "production - techdev14:main",
"useMessageCredentials": "false",
"credentialsCustomer": "techdev14",
"credentialsUser": "main"
}
]