jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.67k stars 310 forks source link

toIntent with external triggers #297

Closed miau2 closed 5 years ago

miau2 commented 5 years ago

I'm submitting a...

Expected Behavior

I'm trying to define some triggers (like a socket) that help me move through skill's flow just when needed. What I want is something like this:

socket.on("example", function() { this.toIntent("InitIntent"); }); (I don't use it that way, it's just to understand it better. I have it like: session.toIntent... where upper I have defined session=this)

but I get this (Log error below): Error: Error: Can't send more than one response per request.

Current Behavior

Error log

Error: Error: Can't send more than one response per request.
    at Promise (C:\Users\...\Folder\node_modules\jovo-framework\lib\jovo.js:221:23)
    at new Promise (<anonymous>)
    at Jovo.executeResponse (C:\Users\...\Folder\node_modules\jovo-framework\lib\jovo.js:
218:16)
    at Jovo.on (C:\Users\...\Folder\node_modules\jovo-framework\lib\jovo.js:48:28)
    at emitOne (events.js:116:13)
    at Jovo.emit (events.js:211:7)
    at AlexaSkill.ask (C:\Users\...\Folder\node_modules\jovo-framework\lib\platforms\alex
aSkill\alexaSkill.js:437:23)
    at Jovo.ask (C:\Users\...\Folder\node_modules\jovo-framework\lib\jovo.js:640:28)
    at Jovo.Unhandled (C:\Users\...\Folder\app\app.js:52:43)
    at Handler.toIntent (C:\Users\...\Folder\node_modules\jovo-framework\lib\handler.js:1
64:54)

Is there any implemented way to do this or it should be requested for next updates?

Your Environment

jankoenig commented 5 years ago

Hi @miau2, could you further elaborate how you would want to use this? Where would the request to the socket come from, still from either Alexa or Google Assistant?

The Can't send more than one response per request. error appears when you try to send out two ask, tell commands or other types of responses.

miau2 commented 5 years ago

I'm trying to select answers either through Alexa / G.Assistant or through an external app.

In this case, I want to have the opportunity of selecting an answer on a tablet (for example), notify my Alexa Skill and in Alexa (or G.Home) go to the selected intent.

Is there any chance of avoiding that error? Any ideas?

Thanks :)

jankoenig commented 5 years ago

Hi there, unfortunately, this is not possible afaik. The architecture of voice applications doesn't allow to let Alexa or Google Assistant get triggered by external events.

There might be some workarounds, for example by using APL Touch Events: https://developer.amazon.com/docs/alexa-presentation-language/apl-user-event.html

jankoenig commented 5 years ago

Hi @miau2, closing this for now. Happy New Year!