It is 2020. It is the year of pandemic. The highest drama and the saddest comedy in which is a president stricken with coronavirus. Now on the heels of a summer of unrest, flood, fire and alarming death toll, it is fall. The feeling of a doomed world lingers.
Well, in this environment, it is easier to be a robot or build a robot. A robot abides rules.
For a RPA bot, everything has to be taught, step by step, chained by logic, bound by reality, programmed in minute details.
Robots have been taught to do a lot of things. For an UiPath robot, there now exists over 400 activities that enables it to work with PDFs, read, write and classify emails, search, extract data and input forms on the web.
An RPA bot is an indefatigable cross-domain master of the mundane and the repetitive.
Creating a simple custom activity
Creating a custom activity involves two major steps: 1) Create a framework class library in visual studio; 2) Create a NuGet package using NuGet package explorer. UiPath has a wonderful tutorial on how to create a custom activity (they always do).
We can sketch out the process by following the old-as-time and pompous tradition in software development: Hello (Crazy) World.
Step 1: Code the custom activity
1: Create a class library project of
.Net Framework type;
2: Add two references:
3: Write your code for the activity driving from a
CodeActivity (for complex ones, you will need to use
For example, the
Hello World custom activity:
4. Build the solution
Step 2: Create the
NuGet Project explorer , add the .dll files in the project release folder.
2. Edit the metadata and save
That’s it. Then we can just add the install the package as we would with any other activity packages. (UiPath again has a tutorial of such).
A sentiment analysis custom activity
Of course, no one cares about an utterly meaningless grandiose
Hello World from no one, definitely not from a bot. I, however, want my bot to take a pulse of the sentiment of human’s utterances. It would be nice that sentences be reduced to a simple score denoting 3 simple sentiments: positive, negative, neutral, right?
Fortunately, there is plenty of help from a handful of tech giants. Google has a slew of text analysis APIs. Microsoft too. For my little custom sentiment analysis activity, I use
Microsoft Text Analytics API . I also used their sample code nearly wholesale style. The quick-start tutorial from Microsoft is available at here.
So here it is, following the steps we laid out in the previous section:
Now that code is written, package made, it is time to use it on a UiPath bot.
After installation, we will add the activity to a simple sequence.
Then we feed the bot a few headlines of the day (Oct 4, 2020). The following is the screenshot of the output.