How to use Windows FTP with Blue Prism
FTP, which stands for File Transfer Protocol, is an oldie but goodie of Internet tools. FTP provides a simple, low cost, and with SFTP, secure mechanism to transfer files. Although APIs are quickly becoming the preferred method of integration, there is still A LOT of FTP/SFTP out there.
A typical business process scenario is: “Every X days, we go to ftp.vendor.com, and pull down a CSV data file, that we then import into Excel and do some work.” Here is a simple example of how you can automate this kind of scenario using Blue Prism.
As with most things in tech, RPA, and Blue Prism included, there are many ways to achieve a solution. When deciding how to use Blue Prism to interact with technology, I see designs falling into three approaches:
1) leverage the application model to “spy” an application GUI, say FileZilla, and then use it to interact directly with the application.
Pros: sets you up to have a reusable component to be used throughout your organization.
Cons: could take some extra time and planning, but then you have a reusable asset, maybe multiple apps are used for FTP.
2) Open up the hood and build some code to create your own VBO.
Pros: complete control over your implementation.
Cons: requires more technical know-how, working at a lower-level of design.
3) Hybrid, build a custom VBO as a wrapper, leverage pre-built components.
Pros: best of both worlds, you get some flexibility to mix and match, while not going too deep.
Cons: not as custom but does not take as long to build.
All three options are good and valid and speak to the flexibility and power of Blue Prism. For this simple example, I am going to go green with a hybrid model. You can always go back and do options 1 or 2 as the value proposition changes.
In my hybrid design, I am going to use two pre-built VBOs that come with Blue Prism to create a new wrapper VBO for FTP functionality.
Utility - File Management VBO - this is an excellent workhorse of utilities, providing actions to handle all sorts of local file and directory management.
Utility - Environment VBO - provides utilities actions for interacting with the environment - read screen resolution, determine OS type, etc.
For FTP, I am going to use the free, built-in windows FTP client via an old school command window.
No pretty GUI but very clean and fast. Here again, lots of different options to interact with the cmd prompt. For this example, I am going to leverage some script files to power the cmd prompt and FTP tasks. Feel free to experiment, i.e., you could use Send Keys/Events to interact with the cmd window.
The digital worker is started either manually or via schedule
Startup parameters are either dynamically passed in via control room, a config file, environment variables, etc.
Delete any existing files - via Utility - File Management VBO
Could make a daily backup and move files into backup-dir
Dynamically create an FTP script file via Utility - File Management VBO
Dynamically create a BAT file via Utility - File Management VBO
Run BAT via Utility Environment VBO
BAT program, in turn, uses FTPScript to execute FTP commands
Upon completion, cmd closes due to the use of “/C” cmd option
Why am I using scripts? Scripts are an excellent way to encapsulate my “conversation” between the digital worker and the CPU. I am also able to create the scripts based on input parameters dynamically. Making your VBO generic and flexible helps promote re-use, increasing ROI.
The Environment VBO lets you start a windows process. Just provide the path and any input arguments, and you are off and running. In our example, I am calling the standard command window, telling it to close upon completion via the “/C” option, along with a cmd script.
The cmd script is straightforward. I change directories to a working location (not required just an option), then run the local windows FTP client and use an associated script. Again I am using the script file as an organizational tool. You could consolidate the scripts, you could send commands directly to the cmd window, all up to you.
For new users of Blue Prism, I will call out a couple of things in this picture. First, this is a snapshot of an Expression builder screen. It is a tool to help build logic and directions in your object or process. In this case, I am mixing hard-coded text, in green, with dynamic data elements in pink.
These run-time data elements will allow for dynamic changes such as which FTP server we are communicating with or the working directory, etc.
The ampersand “&” symbol is how you may concatenate strings (text) together with other data. The elements in pink, between , are data items. Data items let us store information, such as the working directory location.
Another helpful tidbit is the built-in function NewLine(). The NewLine() function will insert a carriage return at the end of the line, ensuring the file is read correctly by the windows command window.
For this exercise, you will need:
Blue Prism (get your 30 day free trial on MS Azure, https://azuremarketplace.microsoft.com/en-us/marketplace/apps/blueprismlimited-4827145.blueprism?tab=PlansAndPrice)
FTP Server (I used a local windows service)
FTP Client (using the built-in windows client)
Zipfile here contains bprelease file of demo VBO and simple test process, along with samples of cmd, ftp scripts and a small csv file for upload/download.
I am going to assume if you are reading this that you have worked with FTP and have a sandbox in mind that you can use to try out the exercise. If not, and your running windows, check out this article to turn on your free FTP server, https://www.windowscentral.com/how-set-and-manage-ftp-server-windows-10
This example is just a quick snapshot of how you could leverage ftp with Blue Prism and is not ready for an enterprise roll out. With any real enterprise-level release you will want to consider all the “un-happy” path scenarios (missing config data, FTP server not available, unable to locate the desired file, etc.)
Hopefully, this gets your wheels turning about how to leverage some of the pre-built VBOs to automate your old, but steady FTP process flows.