How to Build Serverless Slack Apps and Commands
Published: 2020-07-21 19:19:27

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](https://medium.com/slack-developer-blog/build-a-serverless-slack-bot-in-9-minutes-with-node-js-and-stdlib-b993cfa15358), [this](https://www.freecodecamp.org/news/make-a-serverless-slack-app/) and [this](https://github.com/johnagan/serverless-slack-app) 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](https://nimbella.com/product/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](https://nimbella-community.slack.com/apps/AS833QXL0-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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mukm916xzcrtsfc9i20v.png)

You may immediately run a newly created Slack command because [Nimbella Commander](https://nimbella.com/product/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`.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ccxctodoytd5284c9l39.png)

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](https://github.com/nimbella/command-sets/blob/master/echo/packages/echo/echo.js) that echoes input parameters, to more complex ones that perform [timezone conversion](https://github.com/nimbella/command-sets/blob/master/times/packages/times/times.js) or retrieve worldwide [COVID-19 statistics](https://github.com/nimbella/command-sets/blob/master/corona_stats/packages/corona_stats/corona_stats.js). There are also more [advanced Slack apps](https://github.com/nimbella/command-sets#Catalog-of-Command-Sets) 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](https://github.com/nimbella/command-sets#Catalog-of-Command-Sets) 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](https://nimbella.com/signup), pushing your code to GitHub and [installing the commands directly from your Slack prompt](https://nimbella.com/resources-commander/reference#csm_install).

---

## 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](https://github.com/nimbella/command-sets/tree/master/billing)  these commands and [many others, on GitHub](https://github.com/nimbella/command-sets).

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](https://nimbella.com/resources-commander/reference#command_runners). Slack users may also be organized into groups for easier management of access rights. And, Nimbella Commander provides an [audit log](https://nimbella.com/resources-commander/reference#command_log) so that administrators can see which commands were created, edited, or run, and by whom.

---

[Nimbella Commander](https://nimbella.com/product/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](https://twitter.com/nimbella), or of course, in [our community Slack](https://nimbella.com/slack/).

You can read more blogs on related topics:
- [How to Set up your Serverless Environment and Get Started in Less than 2 Minutes!](https://nimbella.com/blog/how-to-set-up-your-serverless-environment-and-get-started-in-less-than-2-minutes/)
- [How to Quickly Deploy Stateful Serverless Apps with Nimbella?](https://nimbella.com/blog/how-to-quickly-deploy-stateful-serverless-apps-with-nimbella/)
- [How to Build a Serverless Slack Command in minutes?](https://nimbella.com/blog/how-to-build-a-serverless-slack-command-in-minutes/)
- [How to Build a Stateful Serverless Cloud Web Application?](https://nimbella.com/blog/how-to-build-a-stateful-serverless-cloud-web-application/)
- [How to use Slack Effectively with Nimbella Commander?](https://nimbella.com/blog/how-to-use-slack-effectively-with-nimbella-commander/)