The alexa_demo submodule exists to demonstrate how to create a "plugin" module that responds to Alexa intents. However, it does so in a very minimal way. It doesn't demonstrate common tasks like getting slot values, handling multiple intents, etc.

Proposed resolution

Improve the alexa_demo submodule by adding demonstration of getting Slot values, returning SSML responses, handling more than one intent. Call $response->endSession() when appropriate.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hampercm created an issue. See original summary.

emerham’s picture

also to add that the demo no longer auto stops, you have to send the

->endSession()

setting at the end of the response. So default case would look like

 $response->respond('Hello Drupal')->endSession();
hampercm’s picture

Issue summary: View changes

Good point, @emerham! That's something I've been meaning to fix for a while now.

emerham’s picture

I've been hacking away at the demo module trying to get slots to work, it appears there is some fragmentation in Github with different Alexa library forks. I am interesting in more development with skills and drupal integration so i will be spending some time poking around and programming here and there.

hampercm’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
Assigned: hampercm » Unassigned
Status: Active » Needs review
FileSize
2.72 KB

This patch for the 7.x branch makes the alexa_demo module a much more fleshed out example, demonstrating slots, SSML, endSession(), Help and Stop/Cancel built-in Intents, and handling of launch and session-end requests.

I'll port it for the 8.x branch.

hampercm’s picture

FileSize
3.05 KB

Update sample_intents.json to specify StopIntent

emerham’s picture

Let me know if you need any help with the 8 version.

hampercm’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
FileSize
3.13 KB

Straightforward port of #6 to Drupal 8

gambry’s picture

I want to flag a module I've been working on trying to unify the Intents coding aspects: Chatbot API.
The aim is to code the intent logic once and implement it with multiple services. Additionally I'll release soon the Views integration, giving the possibility for Intents to filter and iterate through content listed in a View.

It uses D8 plugins system, so I don't think it will ever sees a D7 version.

  1. I would love to have any feedback.
  2. If you like the approach it would be good to move the Alexa integration out of Chatbot API and within this module.
  3. If comments to 1) and 2) are positive, it would be also good to add to the alexa_demo module (D8 only) an example of Intent using Chatbot API plugin.
emerham’s picture

@hampercm I have tested the patch in 8 and it works great. This will get me going in my custom module for managing a thread DB for a hobby.

@gambry
Unification of all the intent's would be a good idea as long as everything will work the same.

gambry’s picture

@emerham chatbot_api successfully talks with Alexa and Api.AI using the same code and logic. The interfaces and the plugin system make sure the unification works great and as far as the driver implement those in the right way for the developer and site-builder point of view everything IS the same. It doesn't matter if your website need to talk to one, two or hundred of services.

And the Drupal Console and Views integration are the cherries on the cake.

I need testers before finalising version 1.0, so I would be very pleased to have feedbacks.

Chris Charlton’s picture

Those changes (in comment #6) to the D7 'alexa_demo' module are good. Much better and more thorough.