January 2017 – NYC Ports & Logistics Hackathon Find the content here: http://bit.do/spark-bot Follow us on Twitter and/or tweet at me. @tessamero and @auhyland By Tessa Mero and Austin Hyland Building Chat Bots Made Easy
January 2017 – NYC Ports & Logistics HackathonFind the content here: http://bit.do/spark-bot
Follow us on Twitter and/or tweet at me. @tessamero and @auhyland
By Tessa Mero and Austin Hyland
Building Chat Bots Made Easy
2© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
SUMMARY• Who Are We?• What Are Chat Bots?• What are the Benefits?• Integrations vs Bots• Getting Started with a Collaboration API• Create a Chat Bot• Using Cloud9 (c9.io)• Create Webhook Events• Test Your Bot!
3© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
What You Will Need• Cisco Spark API Account: https://developer.ciscospark.com/• Create Cloud9 Account: http://c9.io• [optional] JSON Viewer: https://
chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh
4© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Objective
5© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Who is Tessa?
* Developer Evangelist* Teacher* Open Source Contributor* Community Leader* Mother
6© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Who is Austin?
* Developer Evangelist* Technologist* Problem Solver* Teacher* Connector
7© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
What are Chat Bots?
8© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Clippy!
9© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
10© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
11© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
12© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
13© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
What are the Benefits?
14© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
15© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
16© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
17© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Integrations vs Bots
18© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
An integration acts as YOU and can see and do
the things you can do.
19© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
20© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
21© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
A bot appears as another member of the room, but can only see messages
that mention it.
22© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Getting Started with a Collaboration API
23© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
24© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
In this case, we will use Cisco Spark API:https://developer.ciscospark.com/
Then Log In!
Create an Account on the API website
25© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
TODO
TODO
26© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Creating a Chat Bot
27© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Click on “My Apps” and Add New (+)
28© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Select ”Create a Bot”
29© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Add a Bot Image
http://bit.ly/SparkBot-512x512
30© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
31© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Copy API Access Token
32© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Copy API Access Token
33© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Deploy a bot on Cloud9
34© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
c9.io/signup
35© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
36© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
A closer look at the Github URL:
https://github.com/CiscoDevNet/node-sparkbot-samples.
37© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
38© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Install Node.js in Cloud9• In Cloud9, look at the shell terminal at the bottom.
• Type: “npm install” – The nodejs libraries used by our code sample get downloaded to your Cloud9 Workspace
• Now go to helloworld.js under “examples”
• Click “Run” at the top
39© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Create Variables• Click the ENV button at the bottom right of the Cloud9
Terminal
• Create two variables:• DEBUG || sparkbot• SPARK_TOKEN || yourtokenkey
40© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
41© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Make Your Application Public to Share
42© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Create Webhook events
43© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
44© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Create Cisco Spark Webhooks
45© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
200 Success!• Click “Run”
• See a “200/success” displayed – webhook assigned to unique identifier
• Fired off every time a new message is added to a room your bot is a member of
46© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Create Another Webhook• Receive an event every time our bot is added to a room• Modify “resource” field: replace “messages” with
“memberships”
• Click “Run” again
• See a ”200 / success” message!
47© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Test your Cisco Spark Bot
48© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Test Bots Response – type /hello
49© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Mention your bot in Group rooms
50© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Type /hello to test Group chat with bot
51© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Go Further?• Add a few breakpoints in helloworld.js, restart in debug mode• Add some commands. Find samples here:
https://github.com/CiscoDevNet/node-sparkbot-samples• Note: Lots of nodejs bot frameworks exist for Cisco Spark,
from basic to advanced in various languages.
52© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Thank You
@tessamero@auhyland
http://bit.do/spark-bot