SlideShare a Scribd company logo
How to
Develop
Slack Bot
Using
Golang?
https://www.bacancytechnology.com
Introduction
Want to learn to build a slack bot using
Golang? Not sure where you can start? Here
we are to lessen your frustration and ease
your struggles. With the help of the go-slack
package, we will see how to set up a slack
workspace and connect the slack bot with
Golang.




In this tutorial, we will mainly focus on
setting up and creating a bot that can
interact with Slack channels and
workspace. The guide is mainly divided into
two sections:
Slack Set Up: Workspace setup and add
a bot app to it
Golang Set Up and Installation: Coding
part setup in which the bot app will be
sending requests to a Go backend via
Web Socket, termed Socket Mode in the
slack world.




Without further ado, let’s get started with
our tutorial: How to develop Slack Bot using
Golang.

Recommended for you

Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife Spring

This document summarizes Spring features for building loosely coupled, maintainable applications. It discusses how Spring promotes loose coupling through dependency injection and application events. It also describes how to implement workflows with jBPM and manage transactions declaratively in Spring.

aopspringjava
Wave Workshop
Wave WorkshopWave Workshop
Wave Workshop

The document provides instructions for a Google Wave workshop on building interactive gadgets and robots. The workshop covers getting started with Google Wave, downloading necessary files, building a simple voting gadget to demonstrate core gadget functionality, and building an interactive robot using the Google App Engine and Wave Robot API. Attendees will learn how to add external CSS and JavaScript, store and retrieve state data, and set callback functions to update gadgets in real-time in response to events.

google wave
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, PlatformGoogle Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform

These slides introduce the various facets of Google Wave. They were originally delivered as a talk in the 20/20 style (20 slides, 20 seconds each) at the Adobe Platform Users Group Sydney. The slides have been captioned with what was approximately said.

googlewavegooglewave
Create Slack
Workspace
Go to slack and click Create a Workspace.
Add required details, a team or company
name, a channel name, and invite other
teammates who can interact with the bot.
Want the best? Demand the best! Get the
best!
Contact Bacancy and hire Golang
developer from us today to meet your
product requirements. All you need is our
highly skilled Golang experts. Period.
Create Slack
Application

Recommended for you

How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework

I'm sure you may also find it challenging while implementing token authentication using the Django Rest framework. so here is the solutions that help you out to solve the issue.

django rest frameworkdjangorest
Open tok api_tutorials
Open tok api_tutorialsOpen tok api_tutorials
Open tok api_tutorials

This document provides an overview and code samples for basic tutorials using the OpenTok JavaScript API, including a "Hello World" tutorial showing how to connect to a session, publish a webcam stream, and view other streams. It also covers debugging techniques and more advanced tutorials for moderation, signaling, resizing videos, audio-only/video-only streams, passing user info, and recording archives.

OpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdfOpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdf

This document provides tutorials and sample code for using the OpenTok JavaScript API for basic and advanced functionality. It includes tutorials for connecting to a session, publishing and viewing streams, controlling audio/video, moderating sessions, and more. Code samples are provided to demonstrate concepts like connecting to a session, subscribing and publishing streams, and handling events. The document is intended to help developers learn the OpenTok JavaScript API.

opentok_api_tutorials.pdf
Create a Slack application, visit the slack
website and select From scratch option.
Add an application name that will be
allowed by Workspace for further use.
Create a bot with the application.
Click on Bots; this will redirect to the Help
Page, select Add Scopes, and add
permissions to the application.
Click on Review Scopes to Add and add four
main scopes, which make the bot work with
the application.
Now install the application; if you’re not the
owner, then you have to request permission
from an Admin.
The next step is to select a channel the bot
can use to post on as an application.

Recommended for you

JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)

The document provides an overview of new features in JavaServer Faces (JSF) 2.0, including foundational changes, improved system events, resource handling, state saving, GET request support, and a more powerful component model with composite components and behaviors. Key additions are support for Ajax, easier component development through templating with Facelets, and performance improvements through partial state saving.

Integrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat applicationIntegrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat application

Just recently on October 10th, Google announced a change in name of API.AI into DialogFlow. There are a couple of new features following this change. Regardless of what has been changed, in this post we are going to share a simple way of how to integrate your agents that is created using DialogFlow into any Qiscus chat SDK application.

qiscussdkapi.ai
StackMob & Appcelerator Module Part One
StackMob & Appcelerator Module Part OneStackMob & Appcelerator Module Part One
StackMob & Appcelerator Module Part One

This document discusses using the StackMob platform for backend services in mobile applications. It provides an overview of StackMob's features like REST APIs, social integration, push notifications, and more. It then demonstrates creating a basic app with StackMob that includes user and photo objects, and makes API calls to perform CRUD operations on those objects from an Appcelerator mobile app. The document serves as an introduction to integrating StackMob with Appcelerator.

appceleratorstackmobmobile
Click Allow and get the OAuth token and
Webhook URL required for the
authentication process.
Invite the app to a channel. In my case, I
used a channel name slack-bot-golang.
Now, type a command message starting
with this /.; now we can invite the bot by
typing /invite @NameOfYourbot.
How to Develop Slack Bot Using Golang.pdf
Basic Golang
Set-Up and
Installation

Recommended for you

M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA

This document outlines a 4 session bootcamp for learning SharePoint Framework (SPFx) development. Session 1 covers setting up a development environment including an Office 365 tenant and app catalog. Session 2 focuses on building a first web part, including scaffolding, building functionality, and deploying to SharePoint. Session 3 introduces React and rebuilding the web part using React components. Session 4 covers using SPFx within Microsoft Teams. The organizers and contact information for technical assistance are also provided.

Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...

Push notifications allow apps to display messages to users even when the app is not open. This document discusses how to implement push notifications in a React Native Android app using Firebase. It involves setting up the React Native app, configuring Firebase, creating a notification channel, registering for push notifications, sending test notifications, and customizing the notification appearance.

react native
Creating Sentiment Line Chart with Watson
Creating Sentiment Line Chart with Watson Creating Sentiment Line Chart with Watson
Creating Sentiment Line Chart with Watson

Hands-on-lab using Watson APIs to create a sentiment line chart based on positive and negative sentiment within the news.

apipythondevelopers
Create a new directory where we attach
all code further, set up communication
with the Slack channel, and write a code
with the authentication token.
We use the go-slack package that supports
the regular REST API, WebSockets, RTM,
and Events, and we use the godotenv
package to read environment variables.
Develop Slack
Bot using
Golan
First, create a .env file used to store slack
credentials, including channel ID. Find the
Token in the web UI where the application
is created; channel ID can be found in the
UI; go to Get channel details by clicking on
the dropdown arrow of the channel.
Let’s start coding. Create main.go. Start
with connecting to the workspace and post
a simple message to check if everything is
working.
Next, create a slack attachment, which
includes a message that we send to the
channel and add some fields to send extra
contextual data; it’s totally on us if we want
to add this data or not.
// main.go
package main
import (
"fmt"
"os"
"time"
"github.com/joho/godotenv"
"github.com/slack-go/slack"
)

Recommended for you

How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python Framework

Chatbots are software tools created to interact with humans through chat. The first chatbots could create simple conversations based on a complex system of rules.

whatsapp chatbotcreate a whatsapp chatbotflask python framework
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTreeThe Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree

Fastlane is a tool that automates beta deployments and releases for iOS & Android apps. It generates screenshots, takes care of code signing, and uses simple commands. To install Fastlane, use Homebrew to install and then run fastlane init in your project directory. This will create a Fastfile and other files in a fastlane folder to configure build scripts. Typical Fastlane scripts contain lanes for different build processes, like incrementing build numbers, building with gym, uploading to Testflight with testflight, and uploading screenshots to iTunes Connect with deliver. These scripts can be run with commands like fastlane beta or fastlane appstore to streamline the deployment process compared to using Xcode alone.

devopsbuildstesting
How to implement golang jwt authentication and authorization
How to implement golang jwt authentication and authorizationHow to implement golang jwt authentication and authorization
How to implement golang jwt authentication and authorization

characters Explore JSON Web Token and learn more about how to implement Golang JWT Authentication and Authorization.

golang jwtgolang jwt authenticationgolang jwt authorization
func main() {
godotenv.Load(".env")
token :=
os.Getenv("SLACK_AUTH_TOKEN")
channelID :=
os.Getenv("SLACK_CHANNEL_ID")
client := slack.New(token,
slack.OptionDebug(true))
attachment := slack.Attachment{
Pretext: "Super Bot Message",
Text: "some text",
Color: "4af030",
Fields: []slack.AttachmentField{
{
Title: "Date",
Value: time.Now().String(),
},
},
}
_, timestamp, err := client.PostMessage(
channelID,
slack.MsgOptionAttachments(attachment
),
)
if err != nil {
panic(err)
}
fmt.Printf("Message sent at %s",
timestamp)
}
Run the below command to execute the
program. You can see a new message in
the slack channel.
go run main.go
Slack Events
API Call

Recommended for you

How to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.ioHow to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.io

In the tutorial, we will learn about how to build a chat app using ReactJs, NodeJS, and Socket.IO. Clone the Github repository and play around with the code.

reactjschatapp with reactjschat app with nodejs
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro

OpenSocial aims to make the web more social by allowing developers to add social features to websites and applications. The OpenSocial APIs allow gadgets to access user profile data and enable social interactions through features like activities. Developers can focus on building engaging experiences while OpenSocial handles user management and relationships through standards-based gadget specifications and JavaScript APIs.

opensocial
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfReact Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf

The document discusses various alternatives to the React JavaScript framework for building user interfaces. It summarizes a tech talk where React experts discussed alternative frameworks. The main alternatives mentioned include Preact, Inferno JS, Backbone JS, Ember JS, and Vue JS. For each alternative, the document discusses pros and cons compared to React, including characteristics like size, performance, community support, and when each may be preferable to use over React. It provides a high-level overview of the considerations in choosing between React and its alternative frameworks.

react frameworks
Now, use slack events API and handle
events in the Slack channels. Our bot listen
to only mentioned events; if anyone
mentions the bot, it will receive a triggered
event. These events are delivered via
WebSocket.
First, we need to activate the section Socket
Mode; this allows the bot to connect via
WebSocket.
Now, add Event Subscriptions. Find it in the
Features tab, and toggle the button to
activate it. Then add the app_mention
scope to event subscriptions. This will
trigger mentioned new event in the
application.
The final thing is to generate an application
token. Currently, we have a bot token only,
but for events, we need an application
token.
Go to Settings->Basic Information and
scroll down to section App-Level Tokens
and click on Generate Tokens and Scope
and give a name for your Token.
On the app side, we need to add
connections:write scope to that token,
make sure to save the token by adding it to
the .env file as SLACK_APP_TOKEN.
To use Socket Mode, add a sub package of
slack-go called socketmode.
Next, create a new client for the socket
mode; with this, we have two clients, one
for regular API and one for WebSocket
events.

Recommended for you

Data Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdfData Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdf

Data science has many useful applications in retail and healthcare. In retail, it allows for personalized recommendations, fraud detection, price optimization, and sentiment analysis. In healthcare, it facilitates medical imaging analysis, genomic research, drug discovery, predictive analytics, disease tracking and prevention, and monitoring through wearable devices. By analyzing customer, patient, and other relevant data, data science helps these industries better meet needs, enhance experiences and outcomes, and improve operations and decision making.

data science
How Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdfHow Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdf

The document discusses the cost of hiring Golang developers. It begins by providing context on the rise of Golang due to the growth of IoT. The cost of hiring Golang developers depends on factors like experience, location, project size, and engagement model. Hourly rates range from $18-94 in different regions, with rates generally lowest in Asia and highest in North America. Common engagement models include time and materials, fixed price, and dedicated teams. The document aims to help understand the budget needed to hire Golang talent.

hire golang developer
What’s New in Flutter 3.pdf
What’s New in Flutter 3.pdfWhat’s New in Flutter 3.pdf
What’s New in Flutter 3.pdf

Flutter 3 is now stable on macOS and Linux and supports Apple Silicon chips. Key updates include menu support for macOS, Material You design support, improved Firebase integration, foldable device support, and performance improvements for animations and image decoding. Flutter 3 also adds themes extensions and updated ad support while maintaining Flutter's mission of being an open-source, cross-platform framework.

flutter
Now connect the WebSocket client by
calling socketmode.New and forward the
regular client as input and add
OptionAppLevelToken to the regular client
as is now required to connect to the Socket.


At last, we call socketClient.Run() , which
will block and process new WebSocket
messages on a channel at
socketClient.Events. We Put a for loop that
will continuously check for new events and
add a type switch to handle different
events. We attach a go-routine that will
handle incoming messages in the
background to listen to new events. And
with this, we trigger an event on the
EventAPI in Slack.
package main
import (
"context"
"fmt"
"log"
"os"
"time"
"github.com/joho/godotenv"
"github.com/slack-go/slack"
"github.com/slack-go/slack/slackevents"
"github.com/slack-go/slack/socketmode"
)
func main() {
godotenv.Load(".env")
token :=
os.Getenv("SLACK_AUTH_TOKEN")
appToken :=
os.Getenv("SLACK_APP_TOKEN")
client := slack.New(token,
slack.OptionDebug(true),
slack.OptionAppLevelToken(appToken))
socketClient := socketmode.New(
client,
socketmode.OptionDebug(true),
socketmode.OptionLog(log.New(os.Stdout,
"socketmode: ",
log.Lshortfile|log.LstdFlags)),
)
ctx, cancel :=
context.WithCancel(context.Background())
defer cancel()
go func(ctx context.Context, client
*slack.Client, socketClient
*socketmode.Client) {
for {
select {
case <-ctx.Done():
log.Println("Shutting down
socketmode listener")
return
case event := <-socketClient.Events:
switch event.Type {
case
socketmode.EventTypeEventsAPI:
eventsAPI, ok := event.Data.
(slackevents.EventsAPIEvent)
if !ok {
log.Printf("Could not type cast
the event to the EventsAPI: %vn", event)

Recommended for you

Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdfWhy Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf

Why use Ruby on Rails for backend app development? Read this article to know the benefits, types, and popular Ruby on Rails combinations.

hire ruby on rails developer
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdfHow Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf

Looking to Hire Full Stack developer at an affordable rate? Know how much it cost to Hire full stack Developer, types, popular combinations, and hourly rates

#technology#hirefullstack#developer
How to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdfHow to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdf

Checkout this step-by-step tutorial to implement middleware pipeline in VueJS and learn how you can use multiple middlewares on single routes.

#technology#vuejs#tutorial
}
}
}
}(ctx, client, socketClient)
socketClient.Run()
}


To test, run the program and enter the Slack
app or web, and mention by bot by using
@yourbotname.
go run main.go
You should be able to see the event being
logged in the command line running the
bot. The event we get is of the type
event_callback, and that contains a payload
with the actual event that was performed.
Next, start to implement the
HandleEventMessage , which will continue
the type switching. We can use the type
field to know how to handle the Event. Then
we can reach the payload event by using the
InnerEvent field.


func HandleEventMessage(event
slackevents.EventsAPIEvent, client
*slack.Client) error {
switch event.Type {
case slackevents.CallbackEvent:
innerEvent := event.InnerEvent
switch evnt := innerEvent.Data.(type) {
err :=
HandleAppMentionEventToBot(evnt,
if err != nil {
return err
}
}
default:
return errors.New("unsupported event
type")
}
return nil
}
Replace the previous log in the main
function that prints the event with the new
HandleEventMessage function.
log.Println(eventsAPI)
replace with
err := HandleEventMessage(eventsAPI,
client)
if err != nil {
log.Fatal(err)
}
We need to make the bot respond to the
user who mentioned it.
Next start with logging into the application
and adding the users:read scope to the bot
token, as we did earlier. After adding the
scope to the token, we will create the
HandleAppMentionEventToBot

Recommended for you

How to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdfHow to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdf

Read this step-by-step tutorial on how to build Laravel Package using Composer. Also, checkout the github code for implementation.

#laravel#package#technology
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdfSure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf

Want to Improve And Scale Your Node js Performance? Check out some Node Js performance optimization tips and tricks for improving your existing Node Js app.

hire node js developer
IoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdfIoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdf

Explore India&#039;s most advanced cloud platform- IONDASH, responsible for monitoring the performance of battery management system in electric vehicles.

electric vehicle marketelectric vehicle
This function will take a
*slackevents.AppMentionEvent and a
slack.Client as input so it can respond.
The event contains the user ID in the
event.User with which we can fetch user
details. The channel response is also
available during the event.Channel. The
data we need is the actual message the user
sent while mentioning, which we can fetch
from the event.Text.


func
HandleAppMentionEventToBot(event
*slackevents.AppMentionEvent, client
*slack.Client) error {
user, err :=
client.GetUserInfo(event.User)
if err != nil {
return err
}
text := strings.ToLower(event.Text)
attachment := slack.Attachment{}
if strings.Contains(text, "hello") ||
strings.Contains(text, "hi") {
attachment.Text = fmt.Sprintf("Hello
%s", user.Name)
attachment.Color = "#4af030"
} else if strings.Contains(text, "weather")
{
attachment.Text =
fmt.Sprintf("Weather is sunny today. %s",
user.Name)
attachment.Color = "#4af030"
} else {
attachment.Text = fmt.Sprintf("I am
good. How are you %s?", user.Name)
attachment.Color = "#4af030"
}
_, _, err =
client.PostMessage(event.Channel,
slack.MsgOptionAttachments(attachment
))
if err != nil {
return fmt.Errorf("failed to post
message: %w", err)
}
return nil
}
Now restart the program and say hello or hi
and say something else to see whether it
works as expected. You have missed some
scope if you get a “missing_scope” error.
How to Develop Slack Bot Using Golang.pdf

Recommended for you

Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdf

Learn how to develop a mobile app using Flexbox Layout in React Native. Also, check out the github repository to successfully implement the code.

hire react native developer
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdfThe Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf

Is your Laravel app facing performance issues? Here are the proven Laravel Performance Optimization tips to boost app performance and enhance security.

hire laravel developer
New Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdfNew Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdf

The document discusses new features introduced in iOS 15 and Swift 5.5 including bottom sheet customization with UISheetPresentationController, adding submenus to UIMenu, improved location permission with CLLocationButton, using async/await for asynchronous code, Double and CGFloat being interchangeable types, and using lazy in local contexts. It provides code examples for implementing these new features.

Run the
Application
Here is the output of my currently running
a bot
Github
Repository:
Slack Bot Using
Golang
Example
If you want to visit the source code, please
clone the repository and set up the
project on your system. You can try
playing around with the demo application
and explore more.
Here’s the github repository: slack-bot-
using-golang-example

Recommended for you

How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdfHow to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf

Description: Looking for a dedicated team to manage your next product successfully? Read this blog to discover how to hire and manage a remote dedicated team.

technologymarketinghire dedicated offshore development team
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdfChoose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdf

Find out how to choose the right battery management system for lithium ion batteries by analyzing key parameters like voltage, current, and BMS architecture.

Flutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdfFlutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdf

Want to improve Flutter performance in your existing app? Check out this article and get sure shot tips and tricks to run smooth applications.

flutterapplicationapp performance
Conclusion
I hope the purpose of this tutorial: How to
Develop Slack Bot using Golang is served
as expected. This is a basic step-by-step
guide to get you started with
implementing slack bot with the go-slack
package. Write us back if you have any
questions, suggestions, or feedback. Feel
free to clone the repository and play
around with the code.

More Related Content

Similar to How to Develop Slack Bot Using Golang.pdf

Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Rafael Antonio Gutiérrez Turullols
 
How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-
Katy Slemon
 
Real-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelReal-time Automation Result in Slack Channel
Real-time Automation Result in Slack Channel
RapidValue
 
Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife Spring
Mario Fusco
 
Wave Workshop
Wave WorkshopWave Workshop
Wave Workshop
Jason Dinh
 
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, PlatformGoogle Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
Pamela Fox
 
How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework
Katy Slemon
 
Open tok api_tutorials
Open tok api_tutorialsOpen tok api_tutorials
Open tok api_tutorials
Raymond de Jong
 
OpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdfOpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdf
Gestio Organització Comunicació S.A.
 
JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)
Roger Kitain
 
Integrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat applicationIntegrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat application
Erick Ranes Akbar Mawuntu
 
StackMob & Appcelerator Module Part One
StackMob & Appcelerator Module Part OneStackMob & Appcelerator Module Part One
StackMob & Appcelerator Module Part One
Aaron Saunders
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA
Thomas Daly
 
Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...
naseeb20
 
Creating Sentiment Line Chart with Watson
Creating Sentiment Line Chart with Watson Creating Sentiment Line Chart with Watson
Creating Sentiment Line Chart with Watson
Dev_Events
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python Framework
Kommunicate Intentive Inc
 
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTreeThe Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
RedBlackTree
 
How to implement golang jwt authentication and authorization
How to implement golang jwt authentication and authorizationHow to implement golang jwt authentication and authorization
How to implement golang jwt authentication and authorization
Katy Slemon
 
How to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.ioHow to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.io
Katy Slemon
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
Pamela Fox
 

Similar to How to Develop Slack Bot Using Golang.pdf (20)

Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
 
How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-
 
Real-time Automation Result in Slack Channel
Real-time Automation Result in Slack ChannelReal-time Automation Result in Slack Channel
Real-time Automation Result in Slack Channel
 
Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife Spring
 
Wave Workshop
Wave WorkshopWave Workshop
Wave Workshop
 
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, PlatformGoogle Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
 
How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework
 
Open tok api_tutorials
Open tok api_tutorialsOpen tok api_tutorials
Open tok api_tutorials
 
OpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdfOpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdf
 
JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)
 
Integrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat applicationIntegrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat application
 
StackMob & Appcelerator Module Part One
StackMob & Appcelerator Module Part OneStackMob & Appcelerator Module Part One
StackMob & Appcelerator Module Part One
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA
 
Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...
 
Creating Sentiment Line Chart with Watson
Creating Sentiment Line Chart with Watson Creating Sentiment Line Chart with Watson
Creating Sentiment Line Chart with Watson
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python Framework
 
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTreeThe Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
 
How to implement golang jwt authentication and authorization
How to implement golang jwt authentication and authorizationHow to implement golang jwt authentication and authorization
How to implement golang jwt authentication and authorization
 
How to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.ioHow to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.io
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
 

More from Katy Slemon

React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfReact Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
Katy Slemon
 
Data Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdfData Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdf
Katy Slemon
 
How Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdfHow Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdf
Katy Slemon
 
What’s New in Flutter 3.pdf
What’s New in Flutter 3.pdfWhat’s New in Flutter 3.pdf
What’s New in Flutter 3.pdf
Katy Slemon
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdfWhy Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf
Katy Slemon
 
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdfHow Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
Katy Slemon
 
How to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdfHow to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdf
Katy Slemon
 
How to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdfHow to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdf
Katy Slemon
 
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdfSure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
Katy Slemon
 
IoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdfIoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdf
Katy Slemon
 
Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdf
Katy Slemon
 
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdfThe Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
Katy Slemon
 
New Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdfNew Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdf
Katy Slemon
 
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdfHow to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
Katy Slemon
 
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdfChoose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Katy Slemon
 
Flutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdfFlutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdf
Katy Slemon
 
Angular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdfAngular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdf
Katy Slemon
 
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdfHow to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
Katy Slemon
 
Ruby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdfRuby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdf
Katy Slemon
 
Uncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdf
Uncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdfUncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdf
Uncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdf
Katy Slemon
 

More from Katy Slemon (20)

React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfReact Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
 
Data Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdfData Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdf
 
How Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdfHow Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdf
 
What’s New in Flutter 3.pdf
What’s New in Flutter 3.pdfWhat’s New in Flutter 3.pdf
What’s New in Flutter 3.pdf
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdfWhy Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf
 
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdfHow Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
 
How to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdfHow to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdf
 
How to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdfHow to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdf
 
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdfSure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
 
IoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdfIoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdf
 
Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdf
 
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdfThe Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
 
New Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdfNew Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdf
 
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdfHow to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
 
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdfChoose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
 
Flutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdfFlutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdf
 
Angular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdfAngular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdf
 
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdfHow to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
 
Ruby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdfRuby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdf
 
Uncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdf
Uncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdfUncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdf
Uncovering 04 Main Types and Benefits of Salesforce ISV Partnerships.pdf
 

Recently uploaded

The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
Eric D. Schabell
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
Stephanie Beckett
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
Toru Tamaki
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
Neo4j
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 

Recently uploaded (20)

The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 

How to Develop Slack Bot Using Golang.pdf

  • 3. Want to learn to build a slack bot using Golang? Not sure where you can start? Here we are to lessen your frustration and ease your struggles. With the help of the go-slack package, we will see how to set up a slack workspace and connect the slack bot with Golang. In this tutorial, we will mainly focus on setting up and creating a bot that can interact with Slack channels and workspace. The guide is mainly divided into two sections:
  • 4. Slack Set Up: Workspace setup and add a bot app to it Golang Set Up and Installation: Coding part setup in which the bot app will be sending requests to a Go backend via Web Socket, termed Socket Mode in the slack world. Without further ado, let’s get started with our tutorial: How to develop Slack Bot using Golang.
  • 6. Go to slack and click Create a Workspace.
  • 7. Add required details, a team or company name, a channel name, and invite other teammates who can interact with the bot. Want the best? Demand the best! Get the best! Contact Bacancy and hire Golang developer from us today to meet your product requirements. All you need is our highly skilled Golang experts. Period.
  • 9. Create a Slack application, visit the slack website and select From scratch option. Add an application name that will be allowed by Workspace for further use. Create a bot with the application.
  • 10. Click on Bots; this will redirect to the Help Page, select Add Scopes, and add permissions to the application.
  • 11. Click on Review Scopes to Add and add four main scopes, which make the bot work with the application. Now install the application; if you’re not the owner, then you have to request permission from an Admin.
  • 12. The next step is to select a channel the bot can use to post on as an application.
  • 13. Click Allow and get the OAuth token and Webhook URL required for the authentication process.
  • 14. Invite the app to a channel. In my case, I used a channel name slack-bot-golang. Now, type a command message starting with this /.; now we can invite the bot by typing /invite @NameOfYourbot.
  • 17. Create a new directory where we attach all code further, set up communication with the Slack channel, and write a code with the authentication token. We use the go-slack package that supports the regular REST API, WebSockets, RTM, and Events, and we use the godotenv package to read environment variables.
  • 19. First, create a .env file used to store slack credentials, including channel ID. Find the Token in the web UI where the application is created; channel ID can be found in the UI; go to Get channel details by clicking on the dropdown arrow of the channel.
  • 20. Let’s start coding. Create main.go. Start with connecting to the workspace and post a simple message to check if everything is working. Next, create a slack attachment, which includes a message that we send to the channel and add some fields to send extra contextual data; it’s totally on us if we want to add this data or not. // main.go package main import ( "fmt" "os" "time" "github.com/joho/godotenv" "github.com/slack-go/slack" )
  • 21. func main() { godotenv.Load(".env") token := os.Getenv("SLACK_AUTH_TOKEN") channelID := os.Getenv("SLACK_CHANNEL_ID") client := slack.New(token, slack.OptionDebug(true)) attachment := slack.Attachment{ Pretext: "Super Bot Message", Text: "some text", Color: "4af030", Fields: []slack.AttachmentField{ {
  • 22. Title: "Date", Value: time.Now().String(), }, }, } _, timestamp, err := client.PostMessage( channelID, slack.MsgOptionAttachments(attachment ), ) if err != nil { panic(err) } fmt.Printf("Message sent at %s", timestamp) }
  • 23. Run the below command to execute the program. You can see a new message in the slack channel. go run main.go
  • 25. Now, use slack events API and handle events in the Slack channels. Our bot listen to only mentioned events; if anyone mentions the bot, it will receive a triggered event. These events are delivered via WebSocket. First, we need to activate the section Socket Mode; this allows the bot to connect via WebSocket.
  • 26. Now, add Event Subscriptions. Find it in the Features tab, and toggle the button to activate it. Then add the app_mention scope to event subscriptions. This will trigger mentioned new event in the application.
  • 27. The final thing is to generate an application token. Currently, we have a bot token only, but for events, we need an application token. Go to Settings->Basic Information and scroll down to section App-Level Tokens and click on Generate Tokens and Scope and give a name for your Token.
  • 28. On the app side, we need to add connections:write scope to that token, make sure to save the token by adding it to the .env file as SLACK_APP_TOKEN. To use Socket Mode, add a sub package of slack-go called socketmode. Next, create a new client for the socket mode; with this, we have two clients, one for regular API and one for WebSocket events.
  • 29. Now connect the WebSocket client by calling socketmode.New and forward the regular client as input and add OptionAppLevelToken to the regular client as is now required to connect to the Socket. At last, we call socketClient.Run() , which will block and process new WebSocket messages on a channel at socketClient.Events. We Put a for loop that will continuously check for new events and add a type switch to handle different events. We attach a go-routine that will handle incoming messages in the background to listen to new events. And with this, we trigger an event on the EventAPI in Slack.
  • 31. token := os.Getenv("SLACK_AUTH_TOKEN") appToken := os.Getenv("SLACK_APP_TOKEN") client := slack.New(token, slack.OptionDebug(true), slack.OptionAppLevelToken(appToken)) socketClient := socketmode.New( client, socketmode.OptionDebug(true), socketmode.OptionLog(log.New(os.Stdout, "socketmode: ", log.Lshortfile|log.LstdFlags)), ) ctx, cancel := context.WithCancel(context.Background()) defer cancel()
  • 32. go func(ctx context.Context, client *slack.Client, socketClient *socketmode.Client) { for { select { case <-ctx.Done(): log.Println("Shutting down socketmode listener") return case event := <-socketClient.Events: switch event.Type { case socketmode.EventTypeEventsAPI: eventsAPI, ok := event.Data. (slackevents.EventsAPIEvent) if !ok { log.Printf("Could not type cast the event to the EventsAPI: %vn", event)
  • 33. } } } }(ctx, client, socketClient) socketClient.Run() } To test, run the program and enter the Slack app or web, and mention by bot by using @yourbotname. go run main.go You should be able to see the event being logged in the command line running the bot. The event we get is of the type event_callback, and that contains a payload with the actual event that was performed.
  • 34. Next, start to implement the HandleEventMessage , which will continue the type switching. We can use the type field to know how to handle the Event. Then we can reach the payload event by using the InnerEvent field. func HandleEventMessage(event slackevents.EventsAPIEvent, client *slack.Client) error { switch event.Type { case slackevents.CallbackEvent: innerEvent := event.InnerEvent switch evnt := innerEvent.Data.(type) { err := HandleAppMentionEventToBot(evnt,
  • 35. if err != nil { return err } } default: return errors.New("unsupported event type") } return nil } Replace the previous log in the main function that prints the event with the new HandleEventMessage function.
  • 36. log.Println(eventsAPI) replace with err := HandleEventMessage(eventsAPI, client) if err != nil { log.Fatal(err) } We need to make the bot respond to the user who mentioned it. Next start with logging into the application and adding the users:read scope to the bot token, as we did earlier. After adding the scope to the token, we will create the HandleAppMentionEventToBot
  • 37. This function will take a *slackevents.AppMentionEvent and a slack.Client as input so it can respond. The event contains the user ID in the event.User with which we can fetch user details. The channel response is also available during the event.Channel. The data we need is the actual message the user sent while mentioning, which we can fetch from the event.Text. func HandleAppMentionEventToBot(event *slackevents.AppMentionEvent, client *slack.Client) error { user, err := client.GetUserInfo(event.User) if err != nil { return err }
  • 38. text := strings.ToLower(event.Text) attachment := slack.Attachment{} if strings.Contains(text, "hello") || strings.Contains(text, "hi") { attachment.Text = fmt.Sprintf("Hello %s", user.Name) attachment.Color = "#4af030" } else if strings.Contains(text, "weather") { attachment.Text = fmt.Sprintf("Weather is sunny today. %s", user.Name) attachment.Color = "#4af030" } else { attachment.Text = fmt.Sprintf("I am good. How are you %s?", user.Name) attachment.Color = "#4af030"
  • 39. } _, _, err = client.PostMessage(event.Channel, slack.MsgOptionAttachments(attachment )) if err != nil { return fmt.Errorf("failed to post message: %w", err) } return nil } Now restart the program and say hello or hi and say something else to see whether it works as expected. You have missed some scope if you get a “missing_scope” error.
  • 42. Here is the output of my currently running a bot
  • 44. If you want to visit the source code, please clone the repository and set up the project on your system. You can try playing around with the demo application and explore more. Here’s the github repository: slack-bot- using-golang-example
  • 45. Conclusion I hope the purpose of this tutorial: How to Develop Slack Bot using Golang is served as expected. This is a basic step-by-step guide to get you started with implementing slack bot with the go-slack package. Write us back if you have any questions, suggestions, or feedback. Feel free to clone the repository and play around with the code.