how to build advanced voice assistants and chatbots
TRANSCRIPT
Build advanced Voice Assistants and ChatBots
Stève SFARTZAPI Evangelist -Cisco DevNet
[email protected], @SteveSfartz, github://ObjectIsadvantag
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 2
• Experience the CodeMotion Voice Machine & Cisco DevNet ChatBot• Architecture• Introduction to Tropo & Cisco Spark API
• Typical Bot Journey• from Express to a bot framework• what to consider• T
• Ressources to go further
Agenda
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
+39 051 042 1150
!create an account on http://tropo.com to go
hands-on live!3
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
CodeMotion Milan 2016 IVRInteractive Voice Responder
• Call +39 051 042 1150 and listen…
• Dial 1 to receive more details by SMS, 2 for next, 3 for previous• Check you session details on your mobile phone• Text your email to the caller (+1 414 999 0205) /!\ you’re texting US !!! • Launch CiscoSpark, and meet the bot…
4 4
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
dials #1
{CodeMotion} Milan 2016 - Tropo IVR - +39 051 042 1150
« Welcome »
details via SMS
ack
texts email address
/nowcurrent events
calls
texts
« sparks »
IVRJS script
EventsBotCisco Spark
POSTmembership
reachs Support room
SMSBridgeJS library
/emailtexted
Log2SparkJS library
/newlogs
POSTmessage
« ChatOps »Room
« Support »Room
5
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Voice Machine Responderwith Tropo
6
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
What is Tropo ?
7
Cloud APIs enabling developers to quickly and easily embed communication capabilities into their applications and business processes.
7
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
+• Ask • Call • Conference • Hangup
• Record • Reject • Say • Transfer
Tropo in a nutshell
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
say("hello world");
Play an Audio File
say(“http://www.phono.com/audio/troporocks.mp3");
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Outbound Voice Call
call("+14155550100");say("Tag, you’re it!");
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Asking a
Question
Send a Text Messagecall("+14155550100", {network:"SMS"});say("Tag, you’re it!");
Asking a Questionvar result = ask("What's your favorite color? Choose from red, blue or green.", { choices:"red, blue, green"});say("You said " + result.value);log("They said " + result.value);
Voicemail Applicationrecord("Leave your message. Press pound when
finished.", { beep:true, timeout:10, silenceTimeout:7, maxTime:60, terminator:'#', recordFormat:"audio/mp3", recordURI:"ftp://example.com/1.mp3", recordUser:"tropocloud", recordPassword:"password" });
Record an Entire CallstartCallRecording("http://example.com/
recording.js");
ask("What's your favorite color? Red, blue or green.", { choices:"red, blue, green"});
stopCallRecording();
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Local Numbers
• Toll Free• 42+
countries• SIP Addresses
Numbers• Inbound• Outbound• Trunking
included
Voice• Inbound• Outbound• Two-way
Texting
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Transfer• Conference• Headers
Call Control• Speech
Recognition• Text to
Speech• Audio
playback• Recording
Rich Media• Redundant
data centers• Auto-scaling• Usage-based
Cloud
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Account Types
• Free for testing• Low-volume• Restricted use• No production
usage
Developer
• Pre-paid• Credit Card• Self-service
signup• Shared Cloud• one minute
billing increments
Production
• Post-paid invoices
• Contract• SLA• Account
Manager• Shorter billing
increments• Training
Enterprise
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
24x7 supportAll featuresMonitored, Managed Cloud
Developer Production Enterprise
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Globally availableGlobal Outgoing Calls & MessagesNumbers in 42 countries80 speech languages
© 2016 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
+39 051 042 1150« Welcome »
details via SMScalls
IVRscript
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 22
Hands-on: let’s setup the DevNet Quiz IVR
• Create a new Tropo application on http://tropo.com
• Point to the IVR script: http://bit.ly/MILAN2016-1
• Save the application
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 23
Hands-on: setup the DevNet Quiz IVR
• Add a phone number• note : pick a Text-enabled phone number as we’ll leverage SMS later
• Call your IVR
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
IVR highlights• Fork a new Tropo session to send a SMS
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 25
To go further…• Personalize your IVR
• Modify the invites, play audio files• Pick international voices• Use SSML to enhance your User Experience
• Understand how the Tropo Scripting platform manages your files• For development, host your scripts on an external URL for changes to reflect
instanlty• As Tropo will fetch your script everytime it is invoked• Host on Github gist, edit your favorite IDE
• https://www.tropo.com/2016/06/gists-can-help-tropo-scripting-development/ • When going live, host your scripts on Tropo Production File Servers
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Join the Cisco DevNet code labshttps://github.com/CiscoDevNet/codemotion-milan-2016
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco Spark ChatOps
27
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
What are ChatOps ?
“Follow your Tropo application real-time activity in Cisco Spark”
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to setup Cisco Spark ChatOps
To stream logs into CiscoSpark and get instant view about Tropo activity:
1. Create a ChatOps room
2. Add an Incoming Webhook
3. Post messages from Tropo
Quizscript
Spark
Log2Sparklibrary
/newlogs
POSTmessage
« ChatOps »Room
29
12
3
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco Spark
Secure & Open
Complete & Simple
Spark for DevelopersUser Integrations, APIs/SDKs, etc.
Spark Hybrid ServicesCloud + Prem
Partner ServicesInterconnect
Message Meeting Call1:1 and team messaging in virtual
roomsA Cloud-based phone systemAudio, video, and web meetings
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
What is so great about REST? same concept, many Cisco APIs
Easy to BuildWeb appsMobile appsM2M, Bots…
REST API
DEVNET-2002
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
‘Your App’ now with
Cisco Collab!
Spark APIs Extend Cisco Collaboration Cloud
GET
POST
DELETE
PUT/Rooms
/Memberships
/Messages
/Webhooks
/People
/Teams
https://developer.ciscospark.com/
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
Cisco Spark API v1 (July 2016)/People /Rooms /Membership /Messages /Teams /Webhooks
List People List Rooms List Memberships List Messages List Teams List Webhooks
Create a Room Create a Membership Create a Message Create a Team Create a Webhook
Get Person Details Get Room details Get Membership details Get Message details Get Team details Get Webhook details
Update a Room Update a Membership Update a Team Update a Webhook
Delete a Room Delete a Membership Delete a Message Delete a Team Delete a Webhook
GET
POST
DELETE
PUT
DELETE DELETE DELETE
PUT PUT
POST POST POST
GET GET GET
GET GET
GET
GET GETGET
DEVNET-2002
DELETE
PUT
POST
GET
GET
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
• Create a new Cisco Spark room from the CiscoSpark Developer Portal
https://developer.ciscospark.com/endpoint-rooms-post.html
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
DevNet Events BotCheck upcoming events
35
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to connect the ‘DevNet Quiz’ Bot
/nowevent details« sparks »
DevNetEvents BotCisco Spark
reaches the Support room « Support »Room
36
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Join the Cisco DevNet code labshttps://github.com/CiscoDevNet/codemotion-milan-2016
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Further considerations
DEVNET-2002
38
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• from the CodeMotion Conference page • to a json payload provided by Andrea Ferlito• created a REST API out of a Sails.js template
https://github.com/ObjectIsAdvantag/CodeMotionMilan2016
Þ Free your data, you cannot anticipate how much value is laying there, unexploited.
Þ You may not have idea, but be faithful: the community will have a lot !!!
the CodeMotion IVR: a bit of history
39
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 40
Typical bot journey
• Built a few bot samples in NodeJS, starting with Express simple codehttps://github.com/CiscoDevNet/node-sparkbot/blob/master/tests/express-spark-webhook.js
• THEN start a library to abstract:• Express boilerplate, • Notifications listener, • Account detection (human/bot),• Commands interpreter, • Bot Mentions triming• Fallbackshttps://github.com/CiscoDevNet/node-sparkbot Þ sounds familiar ?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
Bot Frameworks survey
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 42
Typical bot journey
• Built a few bot samples, from Express simple code• https://
github.com/CiscoDevNet/node-sparkbot/blob/master/tests/express-spark-webhook.js
• Created a bot framework to simplify repetitive tasks• Express boilerplate, notifications listener, command interpreter, token
detection, bot mentions triming, fallbacks• https://github.com/CiscoDevNet/node-sparkbot
>> always more opiniated, time for choices:• Automation but not loose of control (no magic behind the scene)• Metadata: about, healthcheck endpoint
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 43
Bot MetadataAbout
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 44
Bot MetadataHealthCheck
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 45
Typical bot journey
• Enrich the User Experience• NLP, Conversations, Contexts storage• 3rd party services or DIY approach• BotKit does a pretty good job about conversations & context
• Other concerns• What is this Bot code of conduct ? Are my permissions safe ? What is the usage of my
permissions (live info) ?• OAUTH scopes too large, how to restrict ?• All Web API classics apply: scalability, robustness, analytics, security
Next steps…
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Let’s wrap it up
46
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
dials #1
{CodeMotion} Milan 2016 - Tropo IVR - +39 051 042 1150
« Welcome »
details via SMS
ack
texts email address
/nowcurrent events
calls
texts
« sparks »
IVRJS script
EventsBotCisco Spark
POSTmembership
reachs Support room
SMSBridgeJS library
/emailtexted
Log2SparkJS library
/newlogs
POSTmessage
« ChatOps »Room
« Support »Room
47
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
Key API Features and Use-Cases
• /rooms/people automate room creation and population
• /messages app-driven notifications and reports
• /teams self-service rooms
• /webhooks interactive assistants (chat bots)
• TTS/Speech Recognition voice driven interactive customer service
• SMS automated outbound notifications, inbound SMS apps
• Recording/Transcription voice messaging and voice notes/records
• Telephony/Conferencing notifications and team voice comms
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 49
« Sparkers » community at Cisco DevNethttps://developer.cisco.com/site/spark/
https://learninglabs.cisco.com/tracks/collab-cloud
https://github.com/CiscoDevNet/awesome-ciscospark
Developer Portal• Dev Centers• Support Centers
400,000 Members
Learning labsSpringboards & Sandbox
Hackathons, CodeCamps DevNet Express
Standards & Open Source
DevNet Zone at Cisco Lives
DevNet Kids, IEEE Women in Engineering
API DocumentationProjet Showcases
Forums, Community blogs
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco's presence at CodeMotion 2016
Nov 25th • 10:00: it's all about Developers, discover Cisco DevNet• 11:30: from IoT to Human interactions (Drone Demo)• 14:10: build advanced Voice Assistants and Chat Bots• codelabs: build Chat Bots, create your own IVR (Voice Machine) http://bit.ly/labs2511 Nov 26th • 11:30: Embed Video and Messaging without being an expert
call +39-051-042-1150to hear upcoming sessions
Thank you
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 52DEVNET-3002
@CiscoSparkDev
@CiscoDevNet
@SteveSfartz