SlideShare a Scribd company logo
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
https://source.opennews.org/articles/slack-buttons/
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
chat.postMessage
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
{
"channel": "CBADA55JP",
"attachments": [...]
}
{
"mrkdwn_in": ["text"],
"color": "#36a64f",
"pretext": "Optional pre-text that appears above the attachment block",
"author_name": "author_name",
"author_link": "http://flickr.com/bobby/",
"author_icon": "https://placeimg.com/16/16/people",
"title": "title",
"title_link": "https://api.slack.com/",
"text": "Optional `text` that appears within the attachment",
"fields": [
{
"title": "A field's title",
"value": "This field's value",
"short": false
}...],
"thumb_url": "http://placekitten.com/g/200/200",
"footer": "footer",
"footer_icon": "https://example.com/default_application_icon.png",
"ts": 123456789
}
Building a Bot with Slack Platform and IBM Watson
●
●
●
Building a Bot with Slack Platform and IBM Watson
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello World!"
}
},
{
"type": "divider"
}
]
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello World!"
}
},
{
"type": "divider"
}
"accessory": {
...
}
]
[
...
 
"accessory": {
 "type": "button",
 "text": {
"type": "plain_text",
"text": "Farmhouse",
"emoji": true
},
"value": "click_me_123"
 }
]
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
2
1
Building a Bot with Slack Platform and IBM Watson
User post a message,
“Hi @help_bot”
Sends payload to
request URL
chat.postMessage
Post a
message
Hi here’s some info!
Hi @help_bot
app_mention
event is triggered
●
●
●
●
This link will create a new
repo just for you, with the
code template!
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Create a new app from
2
3
1
4
5
1
2
3
4
5
1
2
3
1
2
3
.env
4
2
1
Click “Show” to
reveal the secret.
Copy then paste in
.env
.env
1
2
Building a Bot with Slack Platform and IBM Watson
2
3
1
https://puzzling-dinner.glitch.me/slack/events
 
1 2
3
4
Building a Bot with Slack Platform and IBM Watson
app_mention
// Greeting any user mentions your bot, @greet_bot
slackEvents.on('app_mention', (message) => {
// When the message is a plain messages and contain 'hi' (case insensitive)
if (/hi/i.test(message.text))) {
// Respond to the message back in the same channel
slack.chat.postMessage(
{ channel: message.channel, text: `Hello <@${message.user}>! :wave:` }
)
}
});
/invite @bot_name
Building a Bot with Slack Platform and IBM Watson
2
1
http://api.slack.com/tools/block-kit-builder
const messageBlocks = [
{
"type": "section",
"text": {
"text": "Hello, welcome to the *Workspace X*nHere's a list of info you are probably looking for:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<https://example.com|*Cafeteria*> n Building 1nSouth-East cornernOpen: 8am - 5pm"
},
"accessory": {
"type": "image",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/3/3b/BHS-Cafeteria.jpg",
"alt_text": "cafeteria"
}
},
// ...
]
n = new line
Building a Bot with Slack Platform and IBM Watson
if(/hi/i.test(message.text)) {
slack.chat.postMessage(...);
}
Hi
I need help
Guide me
Show me the
floor map
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Sends payload to
request URL
chat.postMessage
Post message
Hi here’s some info!
Show me office
directory!
Extract user-sent
message & pass
Process & return
User post a message,
“Hi @help_bot”
app_mention
event is triggered
Building a Bot with Slack Platform and IBM Watson
2
3
1
1
2
1
2
1
3
4
1
2
1
1
const Assistant = require('watson-developer-cloud/assistant/v1');
const Assistant = require('watson-developer-cloud/assistant/v1');
const assistant = new Assistant({
url: 'https://gateway.watsonplatform.net/assistant/api',
version: '2019-04-04',
iam_apikey: process.env.WATSON_API_KEY
});
slackEvents.on('app_mention', (message) => {
const params = {
workspace_id: process.env.WATSON_WORKSPACE_ID,
input: { text: message.text }
};
assistant.message(params, (err, result, response) => {
slack.chat.postMessage({
channel: message.channel,
text: result.output.text[0],
}).catch(console.error);
});
});
Psssst, let’s forget about
BlockKit for now, and post
a simple text!
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson
Building a Bot with Slack Platform and IBM Watson

More Related Content

PPTX
Crawl the entire web in 10 minutes...and just 100€
KEY
Forbes MongoNYC 2011
PDF
Api vortrag
 
KEY
JSON-LD: JSON for Linked Data
PDF
[2019 south bay meetup] Building more contextual message with Block Kit
TXT
Untitled banner piktochart backup data
PDF
Chimoora - Joomla! websites on mobile devices (jwc12)
PDF
Chimoora - Joomla Websites auf mobilen Geräten (jd12de)
Crawl the entire web in 10 minutes...and just 100€
Forbes MongoNYC 2011
Api vortrag
 
JSON-LD: JSON for Linked Data
[2019 south bay meetup] Building more contextual message with Block Kit
Untitled banner piktochart backup data
Chimoora - Joomla! websites on mobile devices (jwc12)
Chimoora - Joomla Websites auf mobilen Geräten (jd12de)

More from Tomomi Imura (20)

PDF
ECMeowScript - What's New in JavaScript Explained with Cats (August 14th, 2020)
PDF
[POST.Dev Japan] VS Code で試みる開発体験の向上
PDF
[Japan M365 Dev UG] Teams Toolkit v4 を使ってみよう!
PDF
[#DevRelAsia Keynote 2020] Developer Centric Design for Better Experience
PDF
Engineering career is not a single ladder! - Alternative pathway to develope...
PDF
Being a Tech Speaker with Global Mindset
PDF
#TinySpec2019 Slack Dev Meetup in Osaka & Tokyo (in Japanese)
PDF
Slack × Twilio - Uniquely Powering Communication
PDF
[2019 Serverless Summit] Building Serverless Slack Chatbot on IBM Cloud Func...
PDF
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
PDF
[日本語] Slack Bot Workshop + Intro Block Kit
PDF
[DevRelCon Tokyo 2019] Developer Experience Matters
PDF
[DevRel Summit 2018] Because we all learn things differently
PDF
[DevRelCon July 2018] Because we all learn things differently
PDF
[Japanese] Developing a bot for your workspace 翻訳ボットを作る!
PDF
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
PDF
Future of the Web with Conversational Interface
PDF
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
PDF
[日本語・Japanese] Creative Technical Content for Better Developer Experience
PDF
Notice Me, Senpai! Get Discovered with Creative Technical Content
ECMeowScript - What's New in JavaScript Explained with Cats (August 14th, 2020)
[POST.Dev Japan] VS Code で試みる開発体験の向上
[Japan M365 Dev UG] Teams Toolkit v4 を使ってみよう!
[#DevRelAsia Keynote 2020] Developer Centric Design for Better Experience
Engineering career is not a single ladder! - Alternative pathway to develope...
Being a Tech Speaker with Global Mindset
#TinySpec2019 Slack Dev Meetup in Osaka & Tokyo (in Japanese)
Slack × Twilio - Uniquely Powering Communication
[2019 Serverless Summit] Building Serverless Slack Chatbot on IBM Cloud Func...
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
[日本語] Slack Bot Workshop + Intro Block Kit
[DevRelCon Tokyo 2019] Developer Experience Matters
[DevRel Summit 2018] Because we all learn things differently
[DevRelCon July 2018] Because we all learn things differently
[Japanese] Developing a bot for your workspace 翻訳ボットを作る!
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
Future of the Web with Conversational Interface
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
[日本語・Japanese] Creative Technical Content for Better Developer Experience
Notice Me, Senpai! Get Discovered with Creative Technical Content
Ad

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Spectroscopy.pptx food analysis technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
MYSQL Presentation for SQL database connectivity
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Review of recent advances in non-invasive hemoglobin estimation
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectroscopy.pptx food analysis technology
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Machine learning based COVID-19 study performance prediction
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
MYSQL Presentation for SQL database connectivity
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Ad

Building a Bot with Slack Platform and IBM Watson