Note: For setup information on using SFTP to import data and download reports, see this article.
Using SFTP automation to import data from your HR system
If your Organization already exported data from your HR system via CSV (for example: from AD) and also has an SFTP account, System admins can create script files and set up tasks to automatically upload import files to Jostle as follows:
Uploading files to your SFTP Account (for Windows)
You'll need to:
- Create a .txt file that will contain the script
- Create a .bat file which will run the script
- Create a task to run your .bat file on a schedule
Create a .txt file that will contain the script
Here's an example:
option batch abort
option confirm off
open sftp://username@sftp.jostle.us -privatekey="C:\Keys\privateKeyToSFTP.ppk"
put C:\exportUsers\jostleContributors.csv /jostle/input/
exit
username = the username we provided to you once your SFTP account was created
path to private key = the path to where your private key is stored (put the private key path inside the quotations)
local drive path = the path to where the upload .csv files are held (don’t put the local drive path in quotations)
Create a .bat file which will run the script
In this example we’re using WinSCP to connect to our SFTP server. If you want to use WinSCP you need to install it in your server.
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=script.txtCreate a task to run your .bat file on a schedule
- Open Task Scheduler
- Once it's open, click Create Task
- Go through the tabs of the Task Setup:
1. On the General tab:
i. Add the Name of the Task
ii. Modify any of the security option (if necessary)
2. On the Triggers tab:
i. Click New
ii. Schedule the frequency and time you’d like the script to run
3. On the Actions tab:
i. Click New
ii. Choose the Action as “Start a program”
iii. In the Program/script section, search for the .bat file you created
4. The Conditions & Settings tabs are optional
Once you have finished configuring the task click OK.
Field mapping
To make sure that the fields in your HR system get properly mapped to the corresponding Jostle fields, you need to create a mappings.csv file with your system's attributes in the first column and the corresponding Jostle fields in the second column.
Note: If using SFTP, the mappings file needs to be place in the "config" folder.
Example:
mail,Username
mail,WorkEmail
givenName,FirstName
surname,LastNameScripting and automation notes
WinSCP references:
- How to use WinSCP's built in scripting and automation features
- How to use WinSCP's .NET assembly to connect to remote machines and manipulate files via custom code.
To set the Host Key for your scripts or code:
- When scripting you can specify the expected fingerprint using
-hostkeyswitch of anopencommand. - With .NET assembly, use
SessionOptions.SshHostKeyFingerprintproperty
Note: Using “*” for hostkey is not best practice because your script would be trusting any key, which could make you susceptible to man-in-the-middle attack.
You can get Jostle's Host Key by connecting to our SFTP server manually with WinSCP and then navigating to Session > Server/protocol information
Server and Protocol Information Dialog
0 Comments