Mais conteúdo relacionado Semelhante a Create an advanced Voice Machine with Tropo Semelhante a Create an advanced Voice Machine with Tropo (20) Mais de Cisco DevNet (20) Create an advanced Voice Machine with Tropo1. Créer un bot, pas si simple.
Faisons le point
Stève SFARTZ
API Evangelist - Cisco DevNet
stsfartz@cisco.com, @SteveSfartz, github://ObjectIsadvantag
2. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
/Cisco/DevNet/SteveSfartz
• API Evangelist @CiscoDevNet
• Cisco Spark Apps & Tropo APIs
• code addict, nodejs, love story
with #golang
• France and all around Europe
• hosted @PIRL – Paris Innovation
Center & Research Lab
• twitter://@SteveSfartz
• github://ObjectIsAdvantag
« Tout objectif
flou conduit à
une connerie
très précise »
Frédéric Dart
stsfartz@cisco.com
@SteveSfartz
3. 3
Zero to advanced Voice Machines
Taking your Chat bots to the next stage
so what’s on the menu
6. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
What is Tropo ?
Cloud APIs enabling developers to quickly
and easily embed communication capabilities
into their applications and business processes.
7. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
+
• Ask
• Call
• Conference
• Hangup
• Record
• Reject
• Say
• Transfer
7
Tropo in a nutshell
8. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
say("hello world");
8
Text to Speech
9. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
Play an Audio File
say(“http://.../troporocks.mp3");
10. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Outbound Voice Call
call("+14155550100");
say("Tag, you’re it!");
1
11. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Send a Text Message
call("+14155550100",
{network:"SMS"}
);
say("Tag, you’re it!");
1
12. Asking a Question
var result = ask("What's your favorite
color? Choose red, blue or green.", {
choices:"red, blue, green"
});
say("You said " + result.value);
log("They said " + result.value);
1
13. Voicemail Application
record("Leave your message. Press
pound when finished.", {
beep:true,
timeout:10,
silenceTimeout:7,
maxTime:60,
terminator:'#',
recordFormat:"audio/mp3",
recordURI:"ftp://.../file.mp3" });
1
14. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to setup a custom IVR
• The IVR is composed of :
• a local phone number
• a custom script executed by the Tropo Scripting platform
dials #1
07 56 78 01 50
« Welcome »
details via SMS
calls
Voice Machine
script
14
15. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to setup your own Voice Machine
• Signup at http://tropo.com
• Create a new Scripting app
• Point to an IVR script:
http://bit.ly/TROPO-IVR
• Pick a phone number
• Save the application
15
16. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Globally available
Global Outgoing Calls & Messages
Numbers in 42 countries
80 speech languages
16
17. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Account Types
• Free
• Low-volume
• Restricted use
• No production
usage
• 24x7 support
Developer
• Pre-paid
• Credit Card
• Self-service
signup
• Shared Cloud
• one minute billing
increments
Production
17
18. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Join the Cisco DevNet code labs
https://github.com/CiscoDevNet/codemotion-rome-2017
19. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Serverless is great
• no deployment hurdles, scalability from day 1
… but
• tedious dev cycles (commit, push, test)
• painful to diagnose (read logs through)
local emulators to the rescue
run and debug locally
integrate in a CI/CD tool chain
Lessons learnt
20. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Tropo Ready!
• Tropo Ready!
• + URL to the project
• Browse the project
https://github.com/ObjectIsAdvantag/tropo-ready-vscode
21. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Best practices: ChatOps
Diagnose & follow real time activity
“Follow your
application usage in
real-time”
22. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Best practices: ChatOps
Diagnose & follow real time activity
“Follow your
application usage in
real-time”
23. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Best practices: ChatOps
Diagnose & follow real time activity
“Diagnose a Serverless script”
24. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to setup ChatOps
To stream logs and get
instant view about your
Voice Machine activity:
1. Create a ChatOps
room
2. Add an Incoming
Webhook
3. Post messages
Voice Machine
script
Log2Spark
library
/new
logs
POST
message
« ChatOps »
Room
1
2
3
24
26. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco Spark
Secure & Open
Complete & Simple
Spark for Developers
User Integrations, APIs/SDKs...
Spark Hybrid Services
Cloud + Prem
Partner Services
Interconnect
Message Meeting Call
1:1 and team messaging Cloud-based phone systemAudio, video, and web meetings
26
27. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
‘Your App’
now with
Cisco Collab!
Spark APIs
extend Cisco Collaboration Cloud
GET
POST
DELETE
PUT
/Rooms
/Memberships
/Messages
/Webhooks
/People
27
/Teams
https://developer.ciscospark.com/
28. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
Meet the roomId bot
• Add roomId@sparkbot.io
to a room
1. The bot sniffs room identifier,
2. Posts the identifier in a 1-1 space,
3. And finally leaves the space you originally invited it to join
https://github.com/CiscoDevNet/node-sparkbot-samples
29. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
• nothing more than an API responding to
events
• a few lines of code with a Bot framework
What it takes to build a Chat Bot
29
30. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Run a bot sample
• Leverages the node-sparkbot framework
• aimed at Cisco Spark bot education
• https://github.com/CiscoDevNet/node-sparkbot
• Community frameworks
• Flint: https://github.com/flint-bot/flint
• BotKit: https://github.com/howdyai/botkit
https://github.com/CiscoDevNet/node-sparkbot-samples
31. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco Spark Cloud
Service
1. interacts in spaces
via a Cisco Spark client
Cisco Spark User
Your Bot code running
On-premise or on a Public Coud
2. posts notifications to
registered WebHooks
Publicly accessible APIs
3. posts messages
as notifications fly in
Bot Architecture
Register WebHook
events your bot is
interested to
listened to
Messages /
created
Memberships /
created
As events happen
in spaces, receive
notifications from
Cisco Spark
32. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco Spark Cloud
Service
1. interacts in spaces
via a Cisco Spark client
Cisco Spark User
DMZ
2. posts notifications to
registered WebHooks
Publicly accessible
3. responds to
Webhook events
Your Bot code running
on-premises
Enterprise secured
2b. forwards notifications
Bot Architecture: on-premises
33. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco Spark Cloud
Service
1. interacts in Rooms
via the various Spark Clients
Cisco Spark User
Tunneling
infrastructure
Your Bot code running
on your local machine
2. posts notifications to
registered WebHooks
Dev environmentPublicly accessible
2b. forwards
Webhook events
3. responds to
Webhook events
Bot Architecture: dev machine
ngrok, localtunnel…
34. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Bot Contest
Sign in on CiscoSpark
Meet the Bot
quizbot@sparkbot.io
Take the challenge
Win an iPhone7…
35. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Meet the QuizBot
35
https://github.com/LucaCalabrese/codemotion-spark-bot
Java, AWS, PostGreSQL, WebHooks @LukeCalab
36. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
@QuizBot help
37. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
@QuizBot now
37
38. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Enhance the User Experience
• Help command
• better show at the invite, welcome message
• But how much help does the bot really
provide?
• /hlp
• Help
• #help
• HELP!!!
Fallback command
39. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Fallback command
39
40. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Add conversations to the game…
40
https://github.com/ObjectIsAdvantag/devnet-botkit-sample
41. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
…and context storage
41
https://github.com/CiscoDevNet/botkit-ciscospark-samples
42. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 42
Bot Frameworks survey
43. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Bot community frameworks
• Flint, https://github.com/flint-bot/flint
• BotKit, https://github.com/howdyai/botkit
44. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Community frameworks for Cisco Spark
Flint
First Bot framework for
Cisco Spark
Highly tuned for the Cisco
Spark API (webhooks
events, moderation…)
Basic Key/Value data store
Coding best practices (ES6,
exception handling, logs,
retries, rate limitation)
BotKit
Largest community Bot
framework
Cross platform support with
code reuse (no magic
convert button: events
name, message formatting)
Advanced Key/Value data
store (user / space level)
Powerful conversational
paradigm
https://github.com/flint-bot/flint https://github.com/howdyai/botkit
46. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
• But who created the bot ?
• What is the usage policy ?
• How can I contact support, send feedback ?
• What about my data privacy ?
47. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
@CiscoDevNet /about
47
48. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
Is the bot down ?
49. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 49
Bot Metadata
HealthCheck
50. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Is the bot down ? a proposal
• Register the Bot in a Universal Database
• Chat services supported
• Healthcheck endpoints
• Author, Policies
• Metadata again…
• chatbot.land domain reserved
• who’s in ? twitter://@SteveSfartz
50
51. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
Hosting
• Many options: IaaS, Containers, PaaS
• Concerns: Availability, Scalability,
Security, Rate Limitation
• Pricing balance: who’s willing to pay for
the bot, and how much
• Heroku PaaS Free Dynos
• AWS/Google/Microsoft free plans
• Currently testing Serverless Functions
52. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Google Functions pricing
52
53. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
The Serverless Functions opportunity
53
https://github.com/ObjectIsAdvantag/devnetexpress-bot
Remember?
a bot is nothing more
than a POST endpoint
…
with an healthcheck !
54. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
The Serverless Functions opportunity
> gcloud alpha functions deploy sparkbot
--entry-point googlefunction
--stage-bucket objectisadvantag-functions
--trigger-http
--memory 128MB
--timeout 1s
54
https://github.com/ObjectIsAdvantag/devnetexpress-bot
55. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
The Serverless Functions opportunity
• An easy way to remove the Serverless burden
55
https://github.com/ObjectIsAdvantag/devnetexpress-bot
57. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
OAuth considerations
58. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 58
API Security Best Practices
59. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
• Pick Bots coding best practices & frameworks
• Exception management, Retries
• Help, Fallback command, Healthcheck
• Conversations (test is challenging)
• Choose the best hosting approach
• Monitor your bot activity
• Chatops + Analytics
• Think twice before going to NLP and then
choose the best approach (local vs 3rd party)
https://devnetcreate.io/2017 Nick Marus’s Talk
60. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
Machine Learning
• The bot companion learns from
interactions
• Use case: classify my Twitter Followers
• Who’s ready to pay for it ?
• Data Privacy vs Real Cost
61. © 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Join the Cisco DevNet code labs
https://github.com/CiscoDevNet/codemotion-rome-2017
Notas do Editor Bots are fun !!!
Thoughts and lessons learnt building:
Voice Machines
Chat Bots
You’re in control TODO: Add URL to the VOICE Machine Understand how the Tropo Scripting platform manages your files
For development, host your scripts on an external URL for changes to reflect instanlty
Tropo will fetch your script everytime
Host on Github gist, edit your favorite IDE
When going live, host your scripts on Tropo Production File Servers
Orange boxes represent custom code
Let’s break it down into the 3 elements.
SPARK MESSAGING – is an easy to use, always connected, service built on the idea of VIRTUAL ROOMS with a excellent MOBILE EXPERIENCE. Messaging, content sharing and BASIC conferencing capabilities are now all in one place. These “rooms” reduce the need for other tools like email and SHAREPOINT that were not truly built to support these types of workers and workstyles.
SPARK MEETINGS – People shouldn’t have to worry about what KIND OF MEETING they’re having. Video Rooms, home office, branch office, Driver’s seat, Airport…Face to Face Video, Voice, and Content Sharing from any DEVICE, any ROOM, and any WORK ENVIRONMENT. Leveraging the #1 Web collaboration tool WebEx.
SPARK CALL – This is your phone system or PBX in the cloud. One-touch directory dialing, Single Number Reach, Single Voicemail from any device, anywhere.
All delivered in a single experience and managed through a single Cloud Collaboration Management Portal. Cloud Collaboration Management provides a single tool for administration, entitlement, management and reporting for Cisco Spark and Cisco WebEx
Building on these 3 ELEMENTS
.
Cisco Spark is an Open Platform with…
Open APIs for application integrations and a playground for developers
Partner Services provides inbound dialing, and PSTN connectivity
And Hybrid Services for integrating Cloud Spark applications with existing on prem investments
We’ll leverage Spark APIs to implement this use case
Spark APIs are accessible at https://developer.ciscospark.com/
This is where you get your API token and run thru the interactive documentation