Dialogflow User permissions

0

I am working on a Dialogflow project where I need access to the data of the users who access my agent. I want to use at least the user's name to create a document with his name in Firebase firestore. I already know that I need permission to access user data, but when I run the code, it does not show me results.

I hope you can help me get even if it's just the user's name.

I leave my name request code in case you want to review it.

app.intent('nombre', (conv) => {    
    conv.data.requestedPermission = 'NAME';
    return conv.ask(new Permission({
        context: 'para obtener tu nombre',
        permissions: conv.data.requestedPermission,
    }));
});

app.intent('user_info', (conv, params, permissionGranted)=> {

    if (permissionGranted) {
        const {requestedPermission} = conv.data;

        if (requestedPermission === 'NAME') {
            const {name} = conv.user;

            if (name) {
                return conv.close('eres ${name}');

            } else {        
                return conv.close('lo siento, no puedo obtener tu nombre');
            }
        }
    } else {
        return conv.close('Permisos denegados');
    }

Greetings.

    
asked by Gaspar Cirilo 29.11.2018 в 11:07
source

0 answers