Member-only story
GOLANG SLACKBOT TUTORIAL
Build Your Slack App Home in Golang Using Socket Mode
Building a home for your app — revisited in Go

This tutorial is about implementing an App Home in Golang with the slack-go library and Slack’s Socket Mode. This guide was inspired by an article from Slack’s documentation.
An App Home is that space that appears under the App section in the conversation list with your app’s name. It is a fully customizable space to provide documentation and interaction with your app.

“Why Socket Mode?” you may ask.
With Socket Mode, you don’t need a server with a publicly available IP address. In other words, your laptop, your Raspberry Pi, or a private server can host your bot. Socket Mode is perfect for small applications that you do not intend to distribute via the App Directory.
Configure Your Application
To start this tutorial, you will need a Slack application with the proper permissions and Socket Mode activated. You can refer to this documentation to create your app and add the permissions. I also wrote a dedicated article to facilitate the setup steps:
Do not forget to activate Socket Mode in the appropriate section.

Step 1: Create the Project Repository
First, create a new Go project and import slack-go:
go mod init
go get -u github.com/slack-go/slack
In this tutorial, I’m using my fork of slack-go because the main feature I am using to handle events has not yet been merged (#PR904).