Automation scripts are automated pieces of code that run on a set schedule or a predefined condition. They can also be triggered manually when they require a specific user input.
For example, instead of manually tagging code reviewers on a pull request, you can write an automation script or use a tool like Airplane to send a list of open pull requests that need a code review to a Discord server at the start of each day.
Airplane is a developer platform for quickly transforming scripts, queries, and APIs into internal applications. If you're looking to quickly spin up internal tools and workflows, Airplane is a great option because it requires little-to-no setup and provides a number of enterprise-grade features out of the box like role-based access controls, schedules, conditional logic, input validation, audit logs, and more.
Python automation scripts
Let's start with a Python example since Python is one of the most frequently used languages for writing automation scripts. Using Airplane, you can write and deploy Python-based tasks to convert functions into reusable apps for your team in just minutes.
See below for an example of a Python automation script. We can write a Python task that selects a code reviewer for the day and sends a Slack message with the required information. This can be represented by the following:
The above code reads a JSON file that contains the GitHub usernames of the developers working at a company. Next, it chooses a random user from the list of choices and returns the selected user’s username.
You can take a Python script like the above or any other Python script and deploy it to Airplane using the Airplane CLI.
You can find more information on deploying Python-based tasks in the documentation.
url of all of the open pull requests in the specified GitHub repository.
We can create and deploy this task to Airplane the same way we did our Python task:
Generating reports using a SQL query
One of the simplest but most common automations is report generation. You can use weekly or quarterly reports for many purposes including tracking performance metrics, monitoring for slow queries, and surfacing flagged transactions.
Let's walk through a quick example of how to use Airplane to generate a report of flagged/suspicious transactions. You can use Airplane to create a three-step reporting workflow that might look something like the below:
- First, we use a SQL query to look up flagged transactions
- Then, we use Python-based task to generate a fraud report
- Finally, a Slack notification is sent with the report to the designated Slack channel using Airplane's Slack integration
Using Airplane, you can write a script and run it on a recurring basis to not only generate a report, but also to send the report to key stakeholders via email or Slack as described in the example above. Using Airplane's native Slack integration, you can easily configure approval flows, send reminders, and paste outputs directly into Slack channels.
To learn more about generating a recurring report with SQL, you can check out this 5-min tutorial.
Syncing data between data sources
Software applications use data that is often collected from multiple sources. For example, some team members may be using Google Sheets, some may be working with Typeform forms, and others may be using traditional data-management sources like MySQL databases.
Most of the time we want this data to live in a single source of truth with only point of access. In order to implement a single source of truth, we have to sync the data between our various data sources. This is another common automation and one that's very easy to solve using Airplane.
A really quick way to solve for this is write a script in Airplane that adds the data from Google Sheets to your production MySQL database or any other non-relational database, depending on the kind of application you're building.
Customer onboarding is one of the most common and useful automations engineers implement within their organizations. Depending on the company, some onboarding steps can be extremely time-consuming and require escalation to the engineering team. Take Dover, a B2B SaaS recruiting platform, for example. In order to onboard new customers they have to go through a series of operations:
- Import historical data from the customer's applicant tracking systems
- Integrate Dover with the customer's email accounts
- Collect data about the role the customer is recruiting for
- Send notifications when accounts have been provisioned
- Answer support questions during the onboarding process
- and much more
Dover uses Airplane to run a set of synchronous scripts to accomplish these tasks after specifying the relevant inputs, like the unique customer ID. Another simple example of a customer onboarding workflow in Airplane might look something like:
- Create an account by running a SLQ query
- Send the user an email for verification using Airplane's email integration
- Verify the user's default payment method using the Stripe API which you can hit using an Airplane task
You can read more about how Dover uses Airplane as their complete internal tooling solution in this case study.
Build sophisticated automations easily with Airplane
In this article we discussed some simple but common automation examples and how to easily implement them using Airplane. These example only scratch the surface of what Airplane can be used for within an organization.
While the example we discussed were simple, Airplane can be used to to build out sophisticated internal applications with a broad set of use cases including workflow automation, scheduled operations, admin panels and user management, long-running jobs, custom full-featured UIs and much more.
If you found anything in this post interesting, sign up for a free Airplane account to try it out or say hello at email@example.com.