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 you have already exported data from your HR system via CSV (for example: from AD) and you also have an SFTP account, you can create script files and set up tasks to automatically upload your files to Jostle as follows:
Uploading files to your SFTP Account (for Windows)
For this 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
1. 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)
2. 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.txt
3. Create 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:
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.
Fields
To make sure that the fields from your HR system get matched up properly with Jostle’s fields you’ll 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 will be stored in the “config” folder.
Example:
mail,Username
mail,WorkEmail
givenName,FirstName
surname,LastName
Scripting/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
-hostkey
switch of anopen
command. - With .NET assembly, use
SessionOptions.SshHostKeyFingerprint
property
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