drupal, alexa, and cheap canned beer - drupalcamp atlanta 2017

22
Drupal, Alexa, and Cheap Canned Beer Paul McKibben Drupalcamp Atlanta November 4, 2017

Upload: paul-mckibben

Post on 21-Jan-2018

43 views

Category:

Software


0 download

TRANSCRIPT

Drupal, Alexa, and Cheap Canned Beer

Paul McKibbenDrupalcamp Atlanta

November 4, 2017

About me...

● Working with Drupal since 2007.

● Run my own consultancy.

● Implemented sites of all sizes on Drupal 5, 6, 7, and 8.

● I like cheap canned beer.

[email protected]

Twitter: @paulmckibben

www.turbojettech.com

The backstory...

Image from https://www.facebook.com/BeerCanMuseumandHallofFame - The Beer Can Museum in East Taunton, MA

● On a whim, I bought the domain cheapcannedbeer.com in 2013, and sat on it.

● Now, 4 years later, I was searching for an excuse to experiment with Amazon’s Alexa.

● “You got chocolate in my peanut butter!” moment.

CheapCannedBeer.com beta

Image: https://commons.wikimedia.org/wiki/File:Free_Beer.jpg

● Being a side project, cheapcannedbeer.com is not far along yet. But…

● The site has a fun Trivia game on it, and…

● You can soon play this Trivia game on Alexa! (skill to be published)

What we’re demonstrating today

Alexa Voice

Services

Alexa, ask Cheap Canned Beer to play Trivia.

Here is your question:...

DemoCheap Canned Beer Trivia

To make this work:

Create an Alexa Skill

● Use the Alexa Skills Kit (ASK) on the Amazon Developer Console

● Define interaction model● Point to your Drupal site

Configure/Develop Drupal Site

● Web-accessible server● SSL certificate● Alexa module + PHP library● Custom module to handle

Alexa events

Alexa Skills Kit: Create a new skill

● Sign up for an account on https://developer.amazon.com

● Create a new skill

● Note your application ID

Allow your skill to connect to your Drupal site

● Install the Alexa module and PHP library. Instructions on https://drupal.org/project/alexa

● Set your Alexa application ID in admin/config/services/alexa

● You will need a custom module to handle your specific skill.

Point Alexa at your Drupal Site

The Alexa module creates the /alexa/callback route

This is the only choice when connecting Alexa to a website

This is the Skill Configuration screen in the Amazon Developer Console

Terminology for Alexa Skills

● Invocation nameThe name users call out to activate your skill.

● Interaction modelThe words and phrases users can say to use your skill. These are modeled as Intents.

● IntentSomething a user wants to do with your skill.

Invocation name

Alexa, ask Cheap Canned Beer to Play Trivia.Intent

A Simple Intent: “Tell Me About”

You can have multiple ways to invoke the intent. These are Utterances.

{Title} is a slot - can be thought of like a parameter for the intent.

This is the Amazon Skill Builder tool on the Developer Console

Handling our Alexa Intents in Drupal

● Alexa module:○ Implements route

○ Dispatches event “alexaevent.request” for other modules to handle

○ Sends other modules’ response back to Alexa.

● Custom module:○ Subscribes to

“alexaevent.request” events.

○ On event, checks for the intents it handles, handles them, and constructs response.

Code & DemoHandling “TellMeAbout”

Trivia and the Dialog model

● Some Alexa intents require a multi-turn conversation to fulfill--not just a simple request & response.

● The Alexa Dialog Model provides the structure for multi-turn conversations.

Handling the Trivia Intent

We have a slot, but it’s not in the first utterance.

The PlayTrivia Dialog

Play trivia

Dialog.ElicitSlot

{Answer} slot

Dialog.ConfirmIntent

{Answer}

No

Here’s your question...

[the correct answer is…]Do you want to play again?

Thanks for playing!

Code & DemoHandling “PlayTrivia”

Challenge with custom dialogs on Drupal

● The Alexa module and PHP library currently don’t support dialog directives.

● I had to hack them to add support.

● I will clean up and contribute my changes back to both.

Conclusion

● Voice interfaces are becoming more widely used.

● Drupal is well-positioned to allow voice interfaces to use and interact with Drupal content.

● This is only the beginning!

Questions?

Contact me:

Paul McKibbenEmail: [email protected]: @paulmckibben

Thank you!

www.turbojettech.com