DialogFlow V2 user id?

2019-05-10 03:49发布

问题:

Is there a way to track user Id between conversations without requiring the user to connect their Google account? Like an anon userId. I don't see any id field in the docs: https://dialogflow.com/docs/fulfillment#request

回答1:

According to the latest usage, conv.user.id is DEPRECATED: Use conv.user.storage to store data instead

For more details, have a look at this answer by Prisoner.



回答2:

you can get userId like this:

let userId = conv.user.id;

Sample intent:

app.intent(INTENT_DEFAULT_WELCOME, conv => { 
    let id = conv.user.id;         
    conv.ask(`Welcome ${id}`);
})