Set userId in Conversational Actions



Hi everyone. It seems that due to user settings in Google Assistant, user storage can’t be maintained and a repeated use of Action results in generating a new userId.
@Andre has described this issue here: Google Devices Rolling User Id

But in my case I also use Sign in with voice - meaning that after first use of Action I get user’s email address. So I have a pair of userId - email.
Second use however creates new userId, but I also have user’s email address in the payload.

One way to solve this problem would be to overwrite newly generated userId with the value from the previous paired userId - email, but I’m not sure how to do it.
I found “setUserId” method in core/ConversationalActionRequest.js but it doesn’t seem to work when called with this.setUserId(“xxxx”)

Any ideas?


Hi @MarekMis , the getId() method of conversational google Actions is looking for this.$user.$params.userId
It is located inside the ConversationalActionUser Object.

I would firstly try to set the userId in the $request object and if this is not working set the $params.userId inside the $user object.

The timing is important: The jovo Object (in this case GoogleAction) will be constructed in the platform.init middleware. So your hook will have to generate the userId in the after.request middleware: