1

When developing for Alexa, every skill has a unique Id. This allows me to develop multiple skills, using the same lambda / codebase, that return unique info based on the skill id.

However, from what I've seen with Google Assistant, Actions don't have ids. Requests include a unique userId and the conversationId. And Responses include an intent id -- but there's no way to identify the action itself.

Any ideas / pointers to things I may have missed?

Prisoner
  • 49,922
  • 7
  • 53
  • 105
nealrs
  • 435
  • 1
  • 5
  • 19
  • This may or may not be germane depending on what "codebase" means exactly but can you differentiate them by the endpoint to which they post? The samples tend to POST to the root but that's not required. Just by the way, I have an Action hosted in a Node server with two Express routers. One fields requests from Alexa, one from Home. They share "business logic". It uses portions of the fine alexa-app and alexa-app-server libraries of Matt Kruse which support multiple skills located each in its own subdirectory. – William DePalo Feb 13 '18 at 00:12

1 Answers1

3

There are a few ways you can approach this, depending on what platform you're using for your webhook.

For both Dialogflow and the Action SDK, you can always specify a unique query parameter as part of the webhook or even have different path portions of the webhook go to the same lambda and examine either the query value or the path. This has the benefit that you're in full control of what the possible values are.

If you're using Dialogflow, there is a unique IntentID for each Intent that comes through. This might be one way to track which one has been invoked. But this seems somewhat kludgy.

Also for Dialogflow, you can set unique headers in the Dialogflow console, and then examine the value of these headers in your webhook. Again, this has the advantage of giving you control of the value.

The Action SDK doesn't have that feature, but it does transmit a JWT token in the Authorization header. This token is for verifying it has come from the correct project (and from Google), but once you've decoded it (and verified it), the aud field should contain the same project ID as the project in the Action Console.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thanks @Prisoner - setting headers / query params is a beautiful solution. Didn't even see that in diagflow. – nealrs Feb 12 '18 at 19:40