We’re excited to announce our Robot JavaScript SDK ( UiPathRobot.js) is now available for preview!
Now you can trigger your local robot directly from existing applications (including browsers), allowing users to start processes from the context that they’re already working in, with all of the necessary contextual information to complete an automated task. And bonus! You can also pass input arguments to your processes.
With the JavaScript SDK you can build anything from a simple RPA calculator, to an Outlook Add-in that processes email attachments when triggered from a button from within Outlook
Get started at https://robotjs.uipath.com/
- This site contains our complete guide, sample app, and full installation instructions
Please tell us what you think below! Your feedback will be critical as we drive toward GA release later this year.
See how it works!
Sample Code
For more details, see the Developer Guide.
UiPathRobot.js uses Promises, but I suggest you use Async-Await because of its clear superiority
In this code snippet we get the list of available processes, find a specific process by its name, and then start that process with a single input. As the process runs we log its status to the console, and once it’s finished we log it’s outputs.
(async () => {
try{
// Get the list of processes
const processes = await UiPathRobot.getProcesses()
// Find a specific process by name
const sample = processes.find(p => p.name.includes("SampleProcessName"))
// Start the process with an input argument (creates a job)
const job = sample.start({ NumberToAdd: 1 })
// When the job status changes, log it to the console
job.onStatus(status => {console.log(`Status: ${status}`)})
// Get the results of the job
const results = await job
// Log the process outputs to the console
console.log(results)
} catch(e) {
// Handle any errors
console.error(e)
}
})()