Início

  • Python RPA → Our message at Web Summit 2022

    Python RPA → Our message at Web Summit 2022

    RPA projects are closer to ordinary software than anything else. It has requirements, data validation, business logic, testing, integrations, etc.

    Business users should be stakeholders, not developers!

    No more shadow it, prototypes that do not scale, and solutions stuck in proprietary formats and proprietary runtime environments.

    Python RPA community is trying to solve this mess, proposing best practices and guidelines to deliver robust, reliable, scalable automation across business units.

    Let’s embrace open technologies, orchestration, governance, elastic computing and the best practices in software engineering.

    Get involved in this movement.
    We’re BotCity, and we’ll deliver this message at Web Summit.

    Find us at our Booth on AI & Machine Learning Alley on November 2nd.

  • BotCity Maestro Updates

    BotCity Maestro Updates

    👋 Hello!

    We are excited to announce a new set of developments that our team has been working on over the last two weeks.

    Our cloud orchestrator BotCity Maestro received major user experience improvements and new features!

    Over the next sections we will cover what changed and guide you through the new features! I hope you enjoy it!

    Simplified Sign Up

    Do you have an e-mail and a password in mind? Great! That’s all you need!

    New sign up form

    New Layouts

    From the new login and password recovery screens all the way to a major product redesign we refreshed BotCity Maestro design and worked to make it more functional and pleasant to work with.

    Login screen

    Your door into BotCity Maestro now not only looks better but it is also more functional and bring you easy access to our community channels.

    New login screen

    The password recovery screen also received a visual update and bug fixes.

    Password recovery screen

    New Home Screen

    The redesigned home screen now features four cards allowing you quick access to download the BotCity Studio SDK, our Documentation Portal, BotCity Academy and the BotCity Maestro.

    BotCity Maestro Home screen

    Log Management

    The log management was only available via the BotCity Command Line Interface (CLI) or via SDK. Logs visualization and download were the only available options via the BotCity Maestro portal.

    Today we are glad to announce the availability to not only visualize and download but also create and exclude logs directly from the BotCity Maestro interface.

    Clicking on the New Log button will take you to the Log creation screen where you can define the Log label, which is the unique ID to be used when interacting with this Log via the BotCity Maestro SDK or API as well as the columns.

    Log creation screen

    Another major change in regards to logs is that they are no longer limited or tied to a single Automation. Now you can create as many logs as you desire to better organize your data and automation management.

    Try it out now!

    Runner Management

    We recently updated our terminology with the intent to simplify the understanding of what Machines are. Recent updates on the BotCity Maestro replaced all occurrences of the term Machine with the more appropriate term Runner.

    To remember, a Runner is a service created by BotCity which runs on a host (computer, virtual machine, cloud-based host, container or some other form). A host can have one or more BotCity Runners being executed in parallel depending on the use case and hardware capabilities.

    In the past we had to create Runners via the BotCity CLI using a command like the one describe below:

    BotCLI machine new -machineId vm01

    Now you can create Runner instances directly from the BotCity Maestro interface by clicking on the New Runner button.

    New runner screen

    The Runner card contains the other operations that you can perform:

    • View instance information
    • View Runner instance log file
    • Capture Screenshot
    • Edit the instance
    • Remove the instance
    Runner card with latest screenshot and action menus

    Bot Management

    Another great change that we are proud to present is the new feature to manage Bots via the BotCity Maestro interface.

    Before this feature was added, the only way to handle the lifecycle of a Bot (Deploy, Release and Update) was via our command line interface and exclusion of bots was not allowed.

    Starting now, you will be able to perform all those operations directly from the BotCity Maestro user interface with a couple of clicks.

    From the new My Bots menu you can now deploy new bots and versions, mark versions of bots as released, update the bot code and exclude them.

    Here is how to do it.

    Deploy

    Deploy is the process used to add new bots or new versions of existing bots on the BotCity Maestro platform.

    You can deploy a bot by simply clicking on the Deploy button and filling the form with the Bot ID, version, file and technology used. Very similar to the syntax of the command line which was:

    BotCLI bot deploy -botId demoWeb -version 1.0 -file demoWeb-1.0.tar.gz -python
    Deploying a new Bot using the BotCity Maestro interface

    Update

    Update is the process used to overwrite or replace the code or executable that a given bot is associated with. Please note that this process is irreversible and will overwrite an existing version even if it is marked as release so please be careful.

    You can update a bot by simply clicking on the pencil icon on the right side of the line associated with your desired bot version and selecting a new file to replace the current one. That is much simpler than the command line which was:

    BotCLI bot update -botId demoWeb -version 1.0 -file demoWeb-1.0.tar.gz -python
    Updating an existing Bot using the BotCity Maestro interface

    Release

    Release is the process used to mark which of the bot available versions is the one currently being used when executing the tasks. This version will be downloaded by the BotCity Runner and executed on your host.

    You can define the released version by simply clicking on the ribbon icon (highlighted by the red arrow below).

    Marking a version as the Release version

    The equivalent procedure via the command line interface was:

    BotCLI bot release -botId demoWeb -version 2.0

    Delete

    A new feature! To remove a deployed version, you can simply click on the trash can icon (highlighted by the red arrow) and confirm on the confirmation dialog that will be displayed.

    Deleting a deployed bot version

    Create your Account

    Don’t have a BotCity Account? Sign up for Free

    More on the Way

    We hope you are enjoying the new features as much as we are while developing and using them.

    As always, if you have questions or find any sort of issues or would like to suggest a feature, feel free to reach out to us via one of our community channels.

    I won’t give you spoilers but there are many cool features coming up over the next weeks! 🚀

    Keep an eye out and make sure to follow us on the social media channels so you can be notified when we release them!

    Have fun automating! 🦾🤖

  • Python RPA + Orchestration – Here it comes.

    Python RPA + Orchestration – Here it comes.

    There is a growing trend for developing RPA solutions as ordinary software using traditional programming languages like Python. As technical squads are involved in such a process, it has become more common to choose coding instead of a low-code solution.

    Benefits of Coding

    There are many benefits of using programming languages to develop your RPAs:

    • Use thousands of open source frameworks for automation-related tasks.
    • Easy to reuse your solutions through modularization (i.e., creating libraries)
    • Automations developed in open technology instead of proprietary format.
    • Adopting software engineering best practices like Design Patterns, Refactoring, Automated Tests, CI/CD.
    • Customize your technology stack based on your needs.
    • Best use of computational resources through software optimization.

    Orchestrating Python RPAs

    However, the development of RPA automation is just one step in delivering a solution to production since you must be able to:

    • Deploy your automations into runtime environments.
    • Schedule your automations.
    • Manage tasks in Queues
    • Monitor executions.
    • Trigger alerts and notifications.
    • Handle errors immediately.

    BotCity Maestro Orchestrator

    BotCity developed a Cloud Orchestrator that addresses all those issues. Now you can deploy and orchestrate your Python RPAs using Command Line Interface (CLI), APIs and web platform.

    Home Screen

    On the Home Screen, a dashboard is shown displaying basic information, so now you have big picture of your entire operation.

    BotCity Maestro Home Screen

    Tasks

    The Task Queue shows tasks in execution, ready to be executed and finished. Each card represents a single task. The color in the bottom bar indicates the state of the task.

    BotCity Maestro Task Queue

    Using the New Task feature, you can create a new task for a specific activity directly from the portal:

    BotCity Maestro New Task Module.

    You might also create tasks through API or CLI. Just a single HTTP Post or CLI command and a new task is going to the Queue.

    Logs

    Logs are a compelling way to track the execution of your automation and collect metrics. You can set different columns for each log table and log information in real-time from a single Python command.

    BotCity Maestro Logs Module.

    Alerts

    When we have multiple automations running at the same time, it is a challenge to visualize the entire operation. Alerts are used to provide small messages that can describe some specific aspect of given automation. Just a single line of Python code and it is done.

    BotCity Maestro Alerts Module.

    Runtime Environments

    Machines are runtime environments used to execute automations. It can be a virtual machine, a container or even a physical machine. It is a computing resource for execution. This module lets you visualize and manage such environments.

    BotCity Maestro Runtimes Module.

    Dashboards

    When it comes to monitoring and managing a complex operation with multiple automations, it is often necessary to have a dashboard that shows the status and critical KPIs. Using BotCity Connectors you can to bring your RPA statistics into Google Data Studio and Power BI.

    BotCity Orchestrator Dashboard Module

    Free Version

    BotCity Maestro Community lets you explore the orchestration of Python RPAs for free. Just signup for free and start using it today.

  • Free Python Automation Course

    Free Python Automation Course

    BotCity Academy is Online 🎓

    We’re pleased to announce that BotCity Academy is online. 🎉

    It is a platform to learn how to develop and manage automations using open source and BotCity. It is totally free.

    The courses are going to provide video lessons, articles, examples, challenges and other references to teach concepts related to automation ops.

    Get Started with BotCity Python

    In our first course, we provide an introduction to BotCity’s technological stack, explain how to setup your development environment and create your first automation through the following lessons:

    • Welcome
    • BotCity
    • Download BotCity Studio SDK
    • Development Environment Setup
    • Hello Bot
    • Desktop Automations
    • Web Automations
    • PDF Processing

    If you don’t have a BotCity account yet, just sign up for free now.

    After login, simply click on the BotCity Academy card to start your learning journey.

  • BotCity Maestro and Documentation Portal

    BotCity Maestro and Documentation Portal

    👋 Hello!

    We are excited to announce two major developments that our team has been working on over the last two months.

    Our cloud orchestrator BotCity Maestro received a major architectural, performance upgrades and a handful of new features.

    Our Developers Portal was merged with our various API reference websites giving origin to our new unified Documentation Portal as to create a place for everything BotCity!

    BotCity Maestro

    From the signup to orchestration of your tasks and dynamic dashboards, everything was rebuilt as to bring you a more modern, performant and robust solution. All that with 100% retro compatibility with existing SDK and API code.

    The experience continue the same, but we have some important new features:

    Login using your e-mail and password

    Here the major change was the replacement of the Login field with the E-mail. Now instead of your login just simply type your e-mail and BotCity Maestro password to access your organization workspace.

    New BotCity Login panel

    Task Queue Performance and Live Update

    Fast access to information is paramount when orchestrating automations and other processes.

    We realized that our Task Queue page started to present some delays for intense operations where thousands of tasks were created every day. With that in mind, our team refactored the UI and the backend to make sure the information about your tasks is available almost instantaneously.

    Moreover, with the previous version users were required to constantly reload the page to obtain newer information about the Task Queue and verify if a task that was queued had start processing, if it was finished and which finishing status it had. Now the BotCity Maestro’s task queue page will automatically update in a reactive format and update your task cards as soon as the status of the task changes. 🚀

    Give it a try and let us know what you think.

    Task Queue

    New Tasks – Directly from the UI

    Up to now, most users created tasks with either the BotCity Command-line Interface (CLI) or via the BotCity Maestro SDK. The “New Task” menu was not generally available.

    We are glad to introduce now the exciting dynamic “New Task” feature.

    Using the New Task feature, you can create a new task for a specific activity directly from the portal. New Task

    Creating a new task is as simple as clicking on the New Task button and confirming the action on the subsequent screen.

    For activities where parameters are involved, the New Task screen will be dynamically construct the proper form with the best components for each field and data type associated. 

    New Task

    Now operators can simply login into BotCity Maestro and create tasks with or without parameters with ease.

    This is the first version of this feature and it will soon receive updates.

    Give it a try now and let us know if you have suggestions. We are excited to hear what you think.

    Alerts Live Update

    For enhanced experience while monitoring your operation, now the Alerts page will automatically load new alerts as they are generated on the platform. This means that you no longer need to reload the page to receive new notifications.

    Other Improvements

    Many other improvements were introduced with this new version, mainly architectural changes for enhanced performance, availability and robustness.

    The Log and Result Files features received a new pagination feature and performance improvements.

    Documentation Portal

    Now you no longer need to bookmark a bunch of links or browse around to find related information about BotCity’s command line interface, a feature at BotCity Maestro or even the Java and Python open-source frameworks.

    We got you covered with our new unified documentation portal.

    Documentation Portal

    This new Documentation Portal is a living organism and it will receive constant updates for APIs, Plugins, Features, Tutorials and much more!

    No need to bookmark it as we made the URL super easy to remember… it is:

    https://documentation.botcity.dev

    Hello, Hola, Olá, こんにちは, Ciao, Hallo, 你好, i18N 🌐

    We are adding Internationalization support to our documentation portal!

    You can select your preferred language via the top menu icon near the search bar:

    As of now, the core language of our documentation is English but our team is working hard to add support to more languages starting with Portuguese.

    As a rule of thumb, if a content is not yet available at your language of choice the system will automatically fallback to English.

    More on the Way

    We hope you are enjoying the new features as much as we are while developing and using them.

    As always, if you have questions or find any sort of issues or would like to suggest a feature, feel free to reach out to us via one of our community channels.

    Have fun automating! 🦾🤖

  • No more Regex or XML conversion to parse PDF Documents

    No more Regex or XML conversion to parse PDF Documents

    Discover now a new approach that mimics the way human vision address document reading

    When creating parsers to read PDF documents automatically, the use of regex rules or converting the document to a structured format like XML to parse it are very common approaches. In both cases, you need to figure out specific rules (regex or XML parsing) for each field in the document. 

    Let’s see an example of parsing some document fields using regex:

    Now, parsing an XML document:

    As can be seen, the parser development can be very laborious depending on the number of fields in the document.

    Moreover, both approaches are very sensitive to changes in the document, like omitting a field or changing its position. Even if this change seems minimal when visualizing the document, it might break the parser since it’s not based on document visual structure.

    Now, let’s take a look at this problem from a different perspective. Why can humans still read a document even if the position or fields are changed? The answer is pretty simple: humans don’t read documents taking into account the position of the fields in the document. For us, usually, we look for a relationship between label and value:

    In red we have the labels that are basically the definition of the field in question and in blue we have the value. Usually, fields (labels and values) are grouped by some context to make the reading process easier, but if we change the position of the fields in the document, humans can still understand the document without any trouble.

    What if it was possible to use the same concept when creating parsers to read documents automatically? What if there was a tool that let you generate the parser code automatically as you click in the field documents and values?

    Let’s talk about BotCity Documents

    BotCity Documents is a framework which allows you to easily create parsers and read documents using Python or Java programming language, in the same way as you naturally would read a document, by establishing a relation between labels and fields.

    Using BotCity Studio intuitive interface and automatic code generation alongside the BotCity Documents framework for document parsing, code to parse a given field in the document is generated pretty simply:

    Step 1 – Select the field in the document

    Step 3 – Code is generated automatically

    This process is repeated for each field in the document you need to read and your custom parser is built in minutes.

    By leveraging the BotCity plugins to seamlessly integrate with your favorite OCR provider, such as Google Cloud Vision, Azure Cognitive Services or even the open-source project Tesseract, BotCity Documents can be extended to transparently deal with not only text-based PDFs but also scanned PDFs and image files using the same codebase.

    All this means less headache creating multiple readers, parsers and integration with third-party services.

    Take a look into BotCity Documents in action and see how you can boost your team’s productivity by constructing parsers not only faster but in a maintainable and more reliable way.

  • From PDF to JSON in minutes. Meet BotCity Docs.

    From PDF to JSON in minutes.                 Meet BotCity Docs.

    Discover now a new approach that mimics the way human vision address document reading

    Enterprise applications and services have the constant need to read, parse and ingest information from a huge variety of documents such as invoices, pay stubs, tax documents and others.

    When dealing with structured formats such as CSV or spreadsheets the task at hand is trivial but when it comes to text-based or scanned PDF documents and images this becomes a struggle.

    To address this issue, developers often make use of regex rules or convert the document to a structured format like XML to parse it. This process is not only very laborious depending on the number of fields in the document but it is also highly sensitive to changes in the document or missing fields.

    Cloud-based pay-per-page services offering a combination of pre-made templates and AI-based document parser generators are on trend  but most of the time those services are niched and outside of the predefined scope of templates available they can only deal with some structured tabular data from text-based PDFs. Moreover, it takes a considerable effort and a large dataset of files to train the AI model which will parse the files with an acceptable level of confidence.

    We humans are more resilient to change on documents when it comes to changes on positions or fields since our vision and brains are always looking for a relationship between labels and values.

    Let’s talk about BotCity Documents

    BotCity Documents is a framework which allows you to easily create parsers and read documents using Python or Java programming language, in the same way as you naturally would read a document, by establishing a relation between labels and fields.

    Using BotCity Studio intuitive interface and automatic code generation alongside the BotCity Documents framework for document parsing, code to parse a given field in the document is generated pretty simply:

    Step 1 – Select the field in the document

    Step 3 – Code is generated automatically

    This process is repeated for each field in the document you need to read and your custom parser is built in minutes.

    This process is repeated for each field in the document you need to read and your custom parser is built in minutes.

    By leveraging the BotCity plugins to seamlessly integrate with your favorite OCR provider, such as Google Cloud Vision, Azure Cognitive Services or even the open-source project Tesseract, BotCity Documents can be extended to transparently deal with not only text-based PDFs but also scanned PDFs and image files using the same codebase.

    All this means less headache creating multiple readers, parsers and integration with third-party services.

    Take a look into BotCity Documents in action and see how you can boost your team’s productivity by constructing parsers not only faster but in a maintainable and more reliable way.

  • Introduction to BotCity’s Web Bots

    Introduction to BotCity’s Web Bots

    Follow this article or the video below to learn how to use Botcity’s Web Bot:

    Prerequisites:

    Step 1 – Use CookieCutter to start a new project

    Creating a Web Bot is very similar to creating a Desktop Bot. Let’s start by using the same CookieCutter command we used to install the Desktop version: “python -m cookiecutter https://github.com/botcity-dev/bot-python-template”.

    You’ll be prompted for the following information:

    • project_type: Make sure to pick “Web”.
    • bot_id: This will be the name of your Python module. If you’re using the BotMaestro integration, then it must match the bot label configured on BotMaestro.
    • project_name: This is the name of the project. You can pick any name you would like.
    • project_short_description: This is a short description of the bot.

    Notice how the Web bot has the same project structure as the Desktop version:

    Step 2 – Configuring the WebDriver

    The Web bot uses the WebDriver engine to provide a very fast and reliable web navigation. In order to use it, you can either have the WebDriver installed on your PATH variable, or provide your automation a path to the WebDriver’s executable. Either way, you must first download it and store it in whatever folder your prefer:

    Then, go to your bot’s source code and add this line to it:

    Step 3 – Playing with the Source Code

    Let’s make things a bit more interesting by changing the default automation a little bit, okay? We’ll make the bot open the BotCity’s youtube channel and extract the current number of subscribers, but feel free to design your own first web bot!

    Step 4 – Run the bot template

    We’ll use the build.bat executable provided in the template to quickly compile our bot, but you could use the terminal to do it as well, like we did for the Desktop bot in our previous article. Then, we’ll run our bot with “python -m firstWebBot”, and verify that it opens Botcity’s Youtube Channel and extracts the correct number of subscribers:

    Now, let’s run this automation again, but with the self.headless variable set to true:

    Now you won’t see the bot opening the BotCity’s youtube channel page, or even the browser. Everything will be done in the background, but you can confirm that it’s still working by checking out the bot’s output on the console:

  • BotCity Maestro integration for Python bots

    BotCity Maestro integration for Python bots

    Follow this article or the video below to learn how to integrate your bots with the Maestro:

    Prerequisites:

    • Runner: download it here.
    • BotCLI: download it here. Alternatively, Botcity’s BotStudio comes with a bundled BotCLI. The Studio can be found here.
    • You must be registered to the BotCity Maestro platform.
    • You must be able to run a bot using the Runner (see how in our previous tutorial here)

    Prerequisites:

    • This article is based on Hugo Slepicka’s in-depth tutorial, which can be found here.

    Step 1 – Log in to BotCity Maestro

    Access the BotCity Maestro platform and log in with your credentials. Notice how you can already take a peek at the task queue from the home page, but since we want more details, click “Task Queue”, as shown in the image below:

    In the Task Queue page, you’ll see a history of the tasks you executed:

    If you have followed our previous tutorial, you should see your first bot execution marked as “Running”. However, you know for sure that it’s already finished. Why is that?

    It is the bot developer’s responsibility to inform the BotCity Maestro via the SDK of the proper final status of a task. This allows for better control and also to add details about the task completion that can later be inspected by users via the BotCity Maestro portal.

    Step 2 – Install Packages

    In this tutorial, we will be adding new lines of code to our bot that requires the botcity-maestro-sdk package to be installed on your computer:

    Keep in mind that, if you created your bot using BotCity’s template, this step is not necessary because it comes with the botcity-maestro-sdk package already listed in your requirements.txt file.

    Step 3 – Set up the RunneStep 3 – Connecting to BotCity Maestro

    Open your source code using whatever IDE or text editor you prefer:

    Let’s start by adding the following import to our code:

    We need to establish a connection between our code and the BotCity Maestro platform. You could do that using BotCityMaestro.login:

    However, since the bot is already being executed by the Runner, there is a more convenient way. Simply use self.maestro, which is already logged in and provides the access_token you need:

    Step 4 – Task Status Integration

    In order to have your future tasks marked as Finished in the Task Queue, use this command at the end of your bot execution:

    Notice how we are taking advantage of the fact our automation is already being executed by the Runner to obtain the task_ID from the execution parameter.

    There are two other status options we could use. AutomationTaskFinishStatus.FAILED and AutomationTaskFinishStatus.PARTIALLY_COMPLETED. It’s up to the user to determine when to use each one of them, but here’s an example of the code after all those modifications:

    Step 5 – Creating a Log

    Knowing that a task was finished, successfully or not, is often not enough when monitoring an automation. There is some precious information collected during the process that may be useful to the user. Fortunately, It’s possible to send it to the BotCity Maestro platform by creating a log, and filling it with log entries.

    To create a log, we provide the activityLabel of the activity we are creating a log for, and a list of Columns that will hold our information. We can do it like this:

    Step 6 – Creating a new Log Entry

    Now that our log has been created, we want to fill it with some information. As an example, we’ll collect the number of subscribers BotCity’s Youtube channel has. Here is a way to do it:

    To add a new entry to our log, we invoke the method new_log_entry, which receives the activity label we have previously obtained, and an object with the values of each log field we want to fill:

    Step 7 – Alerts

    Alerts can be used to display a message in the BotCity Maestro platform that may be classified as an INFO, WARNING or ERROR. For example, we could set an info alert to go off if BotCity’s youtube channel meets a certain subscribers milestone:

    We’ll use 100 subscribers to make sure the alert will go off. Also, keep in mind you can change the alert type to AlertType.INFO, AlertType.WARN or AlertType.ERROR.

    Step 8 – Messages

    It’s also possible to have your bot send a message to a list of BotCity Maestro users or to a list of external email addresses. The message body can be written in either TEXT or HTML format:

    Keep in mind that the email and user list parameters are optional, so you may pass it as an empty list using []. You must provide at least one of the lists with content.

    Step 9 – Artifacts

    It’s possible for your bot to both download and upload files to and from BotCity Maestro.

    Uploading a file only requires one line of code:

    Of course, we’d first have to create the subscribers.txt file:

    Step 10 – Update your automation

    Here is the final version of our code:

    Before testing it out, we need to provide the Runner with the new, updated version. First, we need to rebuild our package:

    Then, we shall use the BotCli to upload our new package to the BotCity Maestro, so it may later be downloaded by the runner:

    Step 11 – Final Test

    Let’s create a new task for the runner, and see what are the results of our bot execution through the BotCity Maestro platform:

    Task Queue:

    Log:

    Alerts

    Message:

    Result Files:

  • Deploying Python bots using BotCity Maestro

    Deploying Python bots using BotCity Maestro

    Follow this article or the video below to learn how to deploy bots:

    Prerequisites:

    • Runner: download it here.
    • BotCLI: download it here. Alternatively, Botcity’s BotStudio comes with a bundled BotCLI. The Studio can be found here.
    • You must be registered to the BotCity Maestro platform.
    • Access to a running Host Machine (which can be a virtual or a physical machine).
    • Java on both machines (to use the Runner and the BotCLI).
    • Python 3.7 or newer +  pip on the Host Machine.
    • (Windows Host Machine only) Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019.
    • (Linux Host Machine only) System Packages: python3-tk + scrot + xsel + xclip.

    Step 1 – Log in to BotCity Maestro

    Access the BotCity Maestro platform and log in with your credentials. In the home page, you may already take a peek at the Task Queue, but let’s go to its own page to see more details:

    You’ll see this screen:

    This is your personal / company environment. Every machine you register, activity you create or bot you deploy will be listed here. For now, notice how we blacked out three of the fields on the screen. They are your “Workspace”, “User” and “Key”. Note them down, because we’ll use this information later.

    Step 2 – Set up your Host Machine

    Let’s assume you have a Host Machine already running, be it a Virtual Machine (either local or cloud) or a Physical Machine. We’ll show you how to install the BotRunner on it and link it to your BotCity Maestro platform. Later, you will be able to run your robot’s tasks and collect it’s logs and reports without even accessing the Host Machine.

    Connect to your Host Machine. In this tutorial, we will use Remote Desktop Connection Manager to connect to a Virtual Machine:

    Assert that Python and pip are installed on the Host Machine with –version:

    Use pip to Install the virtualenv package:

    Step 3 – Set up the Runner on the Host Machine

    Upload the Runner to your Host Machine and extract it wherever you prefer:

    Open the Runner/conf/conf.bcf file, and fill it with the information obtained in step 1:

    Log Screen: Setting this option to true allows the Runner to periodically send a print of the Host Machine screen to be displayed on BotCity Maestro.

    LogApplication: Setting this option to true allows the Runner to periodically send the contents of its own log file to be displayed on BotCity Maestro.

    The Runner is now awaiting for a task addressed to this machine to be created.

    Step 4 – Bot deploy using BotCLI

    We will use the command line to deploy our bot to the host machine. But first, download and extract the BotCLI to your computer. It’s convenient to keep it near or even inside your bot folder:

    Then open its config.properties file:

    Fill it with the information you gathered on step 1. After that, we will use the BotCLI to register our virtual machine to the BotMaestro platform using the following command:

    This process only needs to be done once for each virtual machine.

    Now you need to register your bot to the Maestro Platform. Open your command line interface and position it at the folder your botCLI.jar is, then run the deploy command. You will pass the package’s .tar.gz file path as an argument. If you don’t know how to generate that file, see this.

    You only need to deploy your bot once for each version. If you want to deploy changes to this bot without releasing a new version, simply replace the word deploy in the above command with the word update.

    The next step is to release this version, which will mark it as the standard version to be used when the BotRunner downloads your bot’s executable to the virtual machine. Here, use this command:

    Let’s check if the bot has been properly released with the list command. In this case, the botId parameter is optionals, and not using it causes the CLI to list all versions of every registered robot:

    If you see your bot in this list, then it’s ready to be run, but we still need to create a way to start it from the BotMaestro platform.

    Step 5 – Create an Activity on BotCity Maestro

    An activity describes a task the BotMaestro can start. It describes what machine it should be sent to be executed, what programming language it will execute at (Python or Java), and, if you wish, it can be scheduled for automated execution;

    Let’s create an activity to run our bot. To do that, go to your BotCity Maestro platform and click on Activities:

    And then, New Activity:

    Now complete the fields as shown below:

    Step 6 – Create a Task with BotCLI

    A task can be seen for those familiar with object oriented programming as an instance of an activity. Each time the robot runs, it’s executing a task, and that task has its own ID. To create a task, go back to the BotCLI terminal and use this command:

    Also, a task can be marked as a test task by using the optional parameter -test=true, which allows it to be restarted:

    Once the task has been created, it’s available to be started by the Runner. If you have activated the Runner on step 4, your bot should run in a few moments, but the first execution may take longer, since it needs to create the Python Virtual Environment and install all the required dependencies.

    Step 7 – Test Results

    The bot will perform the same actions as it would if it was on your machine, but in the Host Machine instead. In our example, it will search for the BotCity’s youtube channel, then use the “I’m feeling lucky” button to open it:

    Youtube

  • How to set up your Python Development Environment

    How to set up your Python Development Environment

    For setup you can follow this article or our video guide below:

    Prerequisites:

    Step 1 – Verifying prerequisites

    Let’s begin by making sure Python is properly installed on your computer. To do that, open the command-line interface and type “python –version”, then “python -m pip –version”.

    Step 2 – Use CookieCutter to start a new project

    CookieCutter is a Python command-line utility that allows you to create a project from a project template. To install it, run the command “python -m pip install –upgrade cookiecutter” on your command line interface.

    Then, use this command to start a project from the BotCity Python template: “python -m cookiecutter https://github.com/botcity-dev/bot-python-template”.

    You’ll be prompted for the following information:

    project_type: Pick “Web” if your automation only involves websites. Otherwise, or if unsure, pick “Desktop”.

    bot_id: This will be the name of your Python module. If you’re using the BotMaestro integration, then it must match the bot label configured on BotMaestro.

    project_name: This is the name of the project. You can pick any name you would like.

    project_short_description: This is a short description of the bot.

    Step 3- Project Structure

    The root folder of your project receives the name defined in the project_name above. It contains a Python module with the source code files named after the bot_id variable. Also, the Resource Folder is inside the same folder as the source code.

    Project Folder (firstBot)

    MANIFEST.in: This file defines additional content for the package such as images.

    README.md: Simple README file for your bot project.

    VERSION: This file defines the Bot package version.

    firstBot: Main module for your Bot package.

    build.bat: Batch script to generate the package

    build.sh: Shell script to generate the package

    requirements.txt: File describing the python dependencies for your Bot.

    setup.py: Setup file for the package.

    version: File stating the current bot version

    Main Module of the Package (firstBot)

    __init__.py: This is usually a blank file

    __main__.py: Entrypoint for the module. You don’t need to bother with this file.

    bot.py: Module for your bot code. Here is where you will develop your bot.

    resources: Folder containing resources useful for the Bot.

    Step 4 – Run the template bot

    Let’s perform a quick test to make sure your bot is running correctly. First let’s install the bot package and its dependencies with “python -m pip install -e .”. This command must be executed with the dot at the end if your command-line is positioned in your project folder. Otherwise, you must provide a path to it.

    After that, we can proceed to test the bot. Open your command-line interface and insert “python -m bot_id” (replace bot_id with the ID you chose on step 2):

    The bot should open the botcity.dev page on your default browser. Alternatively, you could run the bot inside your favorite IDE.

    Step 5 – BotStudio Setup

    Open the BotStudio and log in using your account.

    Then, go to File -> New Project:

    And fill the Dialog box with the following information:

    Project Name: You may choose any name you prefer.

    Project Folder: The root folder of your project.

    Source Code: The folder containing the code files you want to edit.

    Resources Folder: The Resources Folder, which is usually inside your

    Then hit the create button.

    Step 6 – Using BotStudio

    To make a quick demonstration of how BotStudio works, we’ll begin by selecting the bot.py file in the BotStudio, and clicking at the line we want it to insert code into.

    In this example, we’ll use google.com to redirect us to BotCity’s youtube channel using the “I’m Feeling Lucky” button. So let’s do some code clean up first. It’s not a complex modification, so we can do it within BotStudio itself.

    This is an overview of the process of generating a click using BotStudio:

       1.In the Code tab, click where you want to insert the code.

       2. In your application, hit the Print Screen button on your keyboard or F9 if you are using MacOS.

        3. Now, you’ll perform 4 clicks:

    a. Click at the target area to zoom.

    b. Click at the upper left corner of the target area.

    c. Click at the lower right corner of the target area.

    d. Click at the upper left corner of the target area one more time.

        4. Name your new selection and set the Action menu to “click”.

        5. Hit the Submit button.

    BotStudio will generate both the image and the code for you. The results should be similar to the picture below.

    There is one last thing to do, which is to paste our search string (botcity youtube channel) before clicking find. We may also clean up the code a little bit.

    By adding the paste method after the find, we ensure it will wait for the page to be loaded.

    Step 7 – Final Test

    By repeating Step 4, you should obtain the following result:

    Google

    Youtube