Get SkillId/Project ID - Jovo 4

amazon-alexa
v4
google-assistant

#1

Hi!
For my application, I need to retrieve the SkillId for my Alexa Skill and the Project Id for my Google Action in the code, how can I do it on Jovo 4?
I found this old topic: Take ID of the skill/actions from database/server , I’d like to be able to do the same with Jovo 4
For example, I tried in my Google Action to set the endpoint like suggested “https://webhook.jovo.cloud/{...}?projectId=test” but using “this.$googleAssistant.getProjectId()” I can’t retrieve that value.

Could you please help me figuring out how to retrieve that info for both Alexa and Google Action? Thanks in advance


#2

There are no project helper methods in v4 yet.

One suggestion: You could use env variables for that.


#3

Hi @AlexSwe, thanks for your answer

Anyway, I’d need to retrieve the SkillID (and Project ID for google) dynamically because I have more skills that call the same endpoint. Depending on which skill called the endpoint I need to retrieve different data from a database, any suggestion on how I can achieve that if I can’t access the Skill ID or Project ID in the code directly?


#4

I managed to get the alexa Skill ID using:
jovo.$request.context.System.application.applicationId

Still no luck with the Action Project ID


#5

Where do you run/host your Jovo app? On Lambda?

For Alexa you can retrieve the skill id from the request.
this.$alexa.getSkillId()

For GoogleAssistant I would recommend adding a query param ?projectId=abc to the url
You can reach it via const projectId = this.$handleRequest.server.getRequestHeaders()['projectId'];


#6

My bad, it’s getQueryParams

const projectId = this.$handleRequest.server.getQueryParams()['projectId'];