Prerequisites
- Headless enabled for your organization. SFTP imports are part of Headless, a premium add-on to the Dromo Enterprise Plan. Get in touch to have it turned on.
- A saved schema. Every connector imports into one saved schema. Create it in Schema Studio or with the Saved Schema API.
- An SFTP user that Dromo can sign in as, with permission to list, read and delete files in the folder. Dromo deletes each file from your server once it has picked it up, so use a folder that holds only files meant for Dromo.
- A backend license key, if you are setting up through the API. See Authentication.
Setting up
1
Create credentials
Credentials tell Dromo how to sign in to your server. Use the create SFTP credentials endpoint.Set
auth_type to "PASSWORD" and send password, or to "KEY" and send private_key. A private key must be in OpenSSH format and must not have a passphrase.Passwords and private keys are stored encrypted and are never returned by the API. For key authentication, the response includes a key_fingerprint so you can confirm which key is in use.The response includes the credentials id, which you need for the next two steps.2
Test the connection
Check that Dromo can reach your server with the test SFTP connection endpoint.Dromo signs in and lists the home folder. The response is
{ "success": true }, or { "success": false, "error": "..." } with the reason. If the connection times out, check that your firewall allows connections from Dromo.3
Create a connector
A connector ties together the credentials, a folder, a saved schema and a schedule. Use the create SFTP connector endpoint.
A regular expression that file names must match to be picked up. Leave it out to pick up every file in the folder. See how files are picked up.
When Dromo checks the folder. See schedule options.
Schedule options
A connector runs on one of two kinds of schedule:How files are picked up
Each time the schedule fires, Dromo signs in, opens the connector’sdirectory and looks at the files directly inside it. Subfolders are not searched.
- If the connector has a
file_regex, only files whose names match it are picked up. The pattern is a regular expression, not a glob, and it is matched from the start of the file name. Use.*\.csv$for every CSV file, not*.csv. - Every matching file in the folder is picked up, each as its own import.
- Dromo copies the file and then deletes it from your server. It does not move or archive it. A file left in the folder would be imported again on the next run, so the delete is how Dromo knows a file is done. Keep your own copy if you need one.
What happens after pickup
Dromo creates one headless import for each file, using the connector’s saved schema as it is at that moment and the file’s name as the import’s filename. From there it is an ordinary headless import: it runs the schema’s validations and hooks, and finishes asSUCCESSFUL, NEEDS_REVIEW or FAILED. See handling import results for what each status means.
Imports from SFTP always run in production mode and count towards your usage.
Where results go
Nothing is written back to your SFTP server. You get the results the same way as for any headless import:- Webhooks (recommended). Set up a webhook for the connector’s saved schema in the dashboard. Dromo sends
import_completedwhen an import succeeds,headless_import_needs_reviewwhen it needs a person to fix something, andheadless_import_failedwhen it cannot be processed. Each one carries the import’s ID. - The Headless API. List headless imports to find the imports a connector created, then retrieve one for its status and review URL, and get its download URL for the cleaned data.
- The dashboard. The Headless page lists each import with its status.
When a connector fails
If a run cannot connect or cannot read the folder, Dromo tries again on the next scheduled run. After 5 failed runs in a row, Dromo turns the connector off and emails your organization’s admins. Fix the cause, test the connection, then turn the connector back on in the dashboard.Changing or removing a connector
Update credentials and connectors with aPUT request to the update SFTP credentials and update SFTP connector endpoints. When updating credentials, leave out password or private_key to keep the one already stored.
Deleting a connector stops its schedule. Imports it has already created are not affected.