3. What Are Bots?
A bot is a software application that runs automated
tasks (scripts).
Typically, bots perform tasks that are both simple
and structurally repetitive, at a much higher rate
than would be possible for a human alone.
https://en.wikipedia.org/wiki/Internet_bot
@girlie_mac
4. Also, it is a user experience that can expose
services to users via conversational engagement
and rich interactions.
What Are Bots?
@girlie_mac
5. "Bots are like new applications
that you can converse with."
-- Satya Nadella, Microsoft (2016)
6. Future of computing revolves
around three principal factors:
● Humans
● Digital assistants
● Bots
17. with Slack API
● Events API to listen to an event (message.im)
when a user sends a direct message to your bot
● When an event is triggered, receive a payload
to get a message text
● Use Web API method, chat.postMessage to
post a message on Slack
@girlie_mac
18. User DM a message
Sends payload to
request URL
USER Bot SLACK
chat.postMessage
Reply to
the user Hello
Hi
message.im
event is triggered
Process the
payload. Extract
the user’s
message & see if
the message
contains a word,
“Hi”
19. Chatbot with RegEx = Not so conversational
if(/hi/i.test(event.text)) {
reply(‘Hello’);
}
Hi
Hello
@girlie_mac
20. Make it Smarter with NLP
if(/hi/i.test(event.text)) {
reply(...);
}
Hi
I need help
Guide me
Show me the
floor map
@girlie_mac
21. What is Natural Language Processing?
Process and analyze natural language data to
make the interactions between computers &
human, artificial & natural languages possible
Conversational Bots & NLP
@girlie_mac
24. Sends payload to
request URL
USER BOT SLACK
chat.postMessage
Reply to the
user
Hi here’s some info!
Show me office
directory!
WATSON
Extract user-sent
message & pass
Process & return
User DM a message
message.im
event is triggered
25. bot.js (Receive Slack events & Post message)
exports.handler = async function handler(params) {
const {challenge, event} = params;
await reply(event.channel, event.text);
return {statusCode: 200};
}
// Get a reply from Watson Assistant
const reply = async(channel, text) => {
const params = {
assistant_id: WATSON_ASSISTANT_ID,
input: { text: text }
};
const result = await assistant.message(params);
sendToSlack(channel, result.output.generic[0].text);
When DM is sent in Slack
Pass the message text from
the user to the function that
handles:
1. Get a reply message via
Watson API
2. Post it on Slack
Watson returns the response
Post the response to Slack
27. Why do you wanna go serverless?
1
Cost-effective
Lowerinfrastructure&
operationalcost
2
Scalable
From
prototypetoproduction
3
Sim
plefunctions
Sim
plifiedprogram
m
ingm
odel
@girlie_mac
33. Expose API Endpoint to Create a Public URL
1
2
Click Create
Managed API
to open the
pop-up
3
Define the API
endpoint. Select
your Action.
4
@girlie_mac
34. Send Slack Events the URL
1
2
3
4
Go to Slack
Config page
Use the public
URL
@girlie_mac