How to Build Serverless Slack Apps and Commands

Jul 07, 2020 | Commander


I was recently looking for articles that describe how to build custom Slack apps, bots, and commands. I found several informative articles that describe using Serverless technology for this purpose (see this, this and this for example). These blogs contain a lot of details, but they also cover a lot of steps.

I want to introduce you to Nimbella Commander as the better, faster, and easier way to build Slack bots and Slack commands. Nimbella Commander requires no new accounts to set up, no command-line tools to start, and you will be done creating your first Slack command in seconds.

One-click, two Slack commands, and profit. I challenge you to find a better, faster, or easier methodology.

Step 1. Click here and install Nimbella Commander into your Slack team. I will tell you more about Nimbella Commander shortly.

Step 2. Create your first Slack command by entering the following text into your Slack prompt: /nc command_create hello 

Step 3. Run the Slack command you just created by typing the following text in your Slack prompt: /nc hello 

build serverless Slack commands

You may immediately run a newly created Slack command because Nimbella Commander generates boilerplate code for you. You can edit the code by clicking the link shown in your Slack team. The code editor is pictured below.

You are effectively done. The whole process should take you no more than a minute to complete. Keep reading for more about Nimbella Commander, including how it works, and some other features it offers.

How do Serverless Slack Apps run using Nimbella Commander?

When you create Slack commands with Nimbella Commander, your code runs as a Serverless app. This means there are no servers for you to provision, manage, or operate. In fact, Serverless means there is no infrastructure for you to think about. You can focus on the value you are adding to your Slack team, the way innovation should be.

You can create Slack commands using the Nimbella built-in editor which opens in your browser. No additional tools or accounts needed. It supports JavaScript, Python, and Go. Commander generates boilerplate code that consists of the main method which wraps the actual implementation of the command in the function called "_command".

edit slack commands

You can code the logic necessary to implement your command, directly in the editor. There are several examples and templates available on GitHub, from a simple Slack command that echoes input parameters, to more complex ones that perform timezone conversion or retrieve worldwide COVID-19 statistics. There are also more complex Slack apps that allow you to manage infrastructure on AWS or DigitalOcean, inspect your Cloud spending, manage GitHub or Jira projects, even manage inventory in your Shopify account, to name a few. All of these are readily available as open source Nimbella Commander apps you can readily install and use from your Slack workspace. Best of all, since the code is yours, you can customize the apps to your needs.

If you want to create more elaborate Slack commands, install dependencies, or use other languages (e.g., PHP, Java, Swift), you can develop your Slack commands offline by creating a Nimbella account, pushing your code to GitHub and installing the commands directly from your Slack prompt.

Secrets Management and Auditing Capabilities.

We initially developed Nimbella Commander for our own needs within Nimbella. One of our earliest objectives was increasing visibility into our spending with various cloud providers. We created commands that our developers could run to see current and projected monthly spending. This helped us reduce our cloud expenses by over 50%. We have since open-sourced these commands and many others, on GitHub.

While developing the cloud spending Slack commands, we found that we needed to handle API secrets while avoiding sharing API keys in Slack, or hard coding them in the implementations. We accomplished this by adding Secrets Management which works by uniquely encrypting API keys entirely outside of Slack, and then attaching the encrypted values to Slack commands. Secrets are automatically decrypted just before commands run, so the code you write can readily use secrets and API keys, without doing additional work.

Another feature in Nimbella Commander limits access to certain Slack commands through explicit access control and entitlement. An administrator must grant a Slack team member the rights to run a command or to edit the code for a command. The access control management is done entirely and conveniently from Slack using slash commands built into Nimbella Commander. Slack users may also be organized into groups for easier management of access rights. And, Nimbella Commander provides an audit log so that administrators can see which commands were created, edited, or run, and by whom.

Nimbella Commander allows you to create Slack apps, bots and commands faster than any other technology available today. It combines the power of Serverless with a superb developer experience so that you can develop rich Slack apps from the tools you are already using daily.

Nimbella Commander is collaborative by its very nature. Multiple developers can work together in shared Slack channels to build, debug, and share Slack apps with their teams. All without servers or infrastructure. It’s your logic, your code, your commands, and nothing else.

What commands will you create? Tell us all about the commands you’re creating, on Twitter, or of course, in our community Slack.

You can read more blogs on related topics:

Authored by: Rodric Rabbah (Twitter, LinkedIn, GitHub, Medium)

Recent Posts