How to Build a Serverless Slack App in Minutes.
This blog is a continuation of “How to Build a Serverless Slack Slash Command in Minutes”. If you haven’t already read that blog, I recommend you read it first to gain a good understanding of the basics of Nimbella Commander.
Once you have learned the basics of Nimbella Commander and how to create and run commands in Slack, you can start building serverless apps in Slack. Using Nimbella Commander, you don’t have to worry about any of the infrastructure associated with a server. All you have to focus on is your code logic! Nimbella Commander makes it even easier by enabling you to build your serverless app in Slack without ever leaving the Slack environment. Once you’ve finished creating your first serverless app, we’ll show you how to publish your code as a command-set. This will allow other developers to install your commands on Slack and other messaging platforms!
This blog assumes you have installed Nimbella Commander for Slack into your workspace.
This blog covers the following topics:
- Creating a serverless custom app in Slack
- Sharing your commands via GitHub and auditing usages from Slack commands
Currency Converter App
You will see the ease of using Nimbella Commander by seeing how to build a currency converter slack app. The app will consist of a single slash command called “convert” which requires 2 mandatory parameters (“from” and “to”) and converts the “from” currency to “to” currency. The command will look like this:
/currency convert usd eur
To begin, create an app within Nimbella Commander. This creates a secure serverless API endpoint which will be your app endpoint that Slack will send requests to. This avoids the typical need to create an API for your app manually by logging into any of the cloud provider’s serverless consoles.
To create an app, we will use the Nimbella Commander app_add command. Run
/nc app_add currency /currency
Take a note of the URL provided by Nimbella Commander, above. This URL will be the Request URL or the Endpoint URL in our Slack APP.
Next, let’s create a slack app. Go to https://api.slack.co/apps and create an app by following the steps shown below:
Please follow these steps to create an app in Slack:
- Click the “Create New App” button
- Call the app “Currency” and select the Slack Workspace you want to install this into.
- On the left side of the screen, locate and click the tab labeled “Slash Commands”.
- Then click the “Create New Command” button that appears in the center of your screen.
- In Command, add the Slash command /currency. In Requested URL, add the URL that Nimbella Commander provided in response to our “app_add” command, above. In Short Description, write that it’s a Currency Converter. Click the “Save” button at the bottom of your page when you’ve filled out these three sections. Make sure you’ve checked “Escape channels, users, and links sent to your app”
- Install the App into your workspace. You can do this by clicking the “Install App” tab on the left side of your screen and clicking the “Install App to Workspace” button that appears.
- You’ll be asked for permission to install it once you click it. Just click “Allow”.
Once the Currency app is created and installed, go back to your slack workspace and type “/currency” and you will see that it doesn’t have any commands yet. When you type “/currency”, a request is sent to the API endpoint you created with the “app_add” command.
Create the convert command by typing /nc command_create convert <from><to>.
Now, let's write the code for the currency converter. We will use the exchange-rates-api npm package to convert the currency. You can find the source of the command here. Copy the code from the link and paste it over all the code found in the page that pulls up when you click “edit the code”.
Once this is done, press “Save”, go back to your Slack prompt and run the command
/currency convert usd eur. As shown below, the command converts 1 USD to Euro.
The app now has a convert command and more commands can be added to the app with command_create command. Once done, your app can be used within your team or you can choose to publish it to the Slack app directory for the general public.
Publish your commands as Command-set:
After you publish your Slack app, you can also publish related commands as Command-Sets in Github in Nimbella's Command Set Registry repo. This is similar to the npm registry and contains a collection of command-sets. This way, anyone can install your commands by running, /nc csm_install currency in their slack.
You can also publish your command-set in your repos as well. I have created a public command-set for currency here which anyone can install with /nc csm_install github:niks3089/currency-command-set
The advantages of publishing your command within a Command-Set:
You can write your commands once and run it on other messaging platforms such as Teams.
It is easier to add, make changes, and update your commands. You wouldn’t have to wait for the approval and can simply update with “csm_update”
As command-sets, you get built-in access control, logging, and debugging as explained in Blog 1.
This blog illustrated how to create a Serverless Slack app using Nimbella Commander. This process is agnostic of Cloud providers and avoided any effort associated with an infrastructure for your APIs. Nimbella Commander enables you to focus solely on writing your business logic, which allows you to developer Slack apps much faster than the traditional way. Our plans are to make Nimbella Commander a cross-platform tool so you write a command once, deploy it nowhere, and run it from anywhere. Stay tuned!
If you wish to add Commander to your Slack account, just click this link to get started!
Written by Nikhil (medium)
- Nimbella joins DigitalOcean
- No infrastructure, just code. Learn the simplicity of serverless
- How to Migrate from Containers to Nimbella Serverless Architecture
- Kubernetes in simple words: explained by Eric Swildens
- How to optimize Kubernetes costs with Nimbella
- Step by step guide on how to port from AWS to Nimbella
- How to build and improve your serverless APIs
- Simplifying Kubernetes For Developers
- FaaS Wars Season 2 - Step By Step Instructions
- What is Nimbella and what does it offer?
- Results and Feedback of FaaS Wars - May the FaaS Be with You!
- 28 Serverless Gurus and experts One Must Follow in 2021
- The Faas Wars Alert!
- CI/CD pipeline with GitHub Actions
- How to deploy Node.js functions on Nimbella
- Kick-Start Your Serverless Journey
- AWS re:Invent Serverless Highlights
- Opportunities in the Wake of the AWS Juggernaut
- FaaS Wars: Serverless & Virtual Robot Competition
- #DeveloperIPL Online Hackathon Results & Feedback on Nimbella's Integration for Postman
- How to connect to the 3rd party database such as MySQL at Nimbella (example in Java)
- What can you do with the Nimbella Workbench?
- Deploy your Shopify Storefront to Nimbella
- Not All Serverless Platforms Are Created Equal
- Nimbella + Netlify: Uplevel Your Development Speed
- How we learned to Jamstack, Our Caputron story | Nimbella.com®
- Commander for Microsoft Teams - Your Custom Bot that runs on your Command!
- How to Build a Stateful Cloud App on Nimbella vs. AWS
- Starter Kit and Resources to Build a Serverless Cloud Application
- How to Build Serverless Slack Apps and Commands
- How to Set up your Serverless Environment and Get Started in Less than 2 Minutes!
- How to Quickly Deploy Stateful Serverless Apps with Nimbella?
- What is Serverless Computing? 3 reasons to start now
- How to Build a Serverless Slack App in Minutes.
- How to Manage your Netlify Website from Slack?
- How to Build a Serverless Slack Command in minutes
- How to Build a Stateful Serverless Cloud Web Application?
- How to Create an Optical Character Recognition (OCR) Application?
- Development at the Speed of Innovation – Nimbella, the Serverless Cloud
- Software Security Features on Enterprise Serverless Slack Apps Enabled by Nimbella Commander
- Coronathon India’s first demo day has 18 projects to help fight COVID-19
- See the time in different cities on Slack with Nimbella Commander
- Greet your friends in their native language in Slack with Nimbella Commander
- How to Fetch your Digital Ocean Billing Info on Slack?
- How to Stay Updated with Coronavirus Statistics on Slack?
- How to Fetch your AWS Billing Info on Slack?
- Get your Datadog billing info in Slack with Nimbella Commander
- Serverless Slack Apps and Slash Commands
- How to use Slack Effectively with Nimbella Commander?
- How to Create a multi-user Chatroom Hosted on Serverless Cloud?
- Using Docker actions, running Golang, and other fun things with OpenWhisk
- The duality between serverless functions and APIs
- Serverless HTTP handlers with OpenWhisk
- Serverless functions in your favorite language with OpenWhisk
- Run Swiftly: precompiled Swift actions
- Performance debugging for serverless functions using the Cloud Shell
- Locally debugging OpenWhisk actions
- Composing functions into applications
- A Serverless Composition of Functions
- The Serverless Contract
- The dawn of the Cloud Computer
- Security and Serverless Functions