Chaining Permission Intent












1















What's the correct way to chain from a permission intent to another with Dialogflow?



I've got two intents setup:



app.intent('ask_for_permission', async (conv) => {
return conv.ask(new Permission({
context: 'to get your location',
permissions: 'DEVICE_PRECISE_LOCATION',
}));
})


app.intent('confirm_permissions', async (conv, params, confirmationGranted) => {
conv.ask(`I think you gave me permission? ${params} ${confirmationGranted}`)
})


And within the Dialogflow control panel I have it setup so the ask_for_permission intent follows on to the confirm_permissions intent like so:



Dialogflow UI



But whenever I trigger the ask_for_permission intent, the user gets asked if they want to share their location, but responding with either yes or no doesn't actually trigger the user to move onto the next intent.



enter image description here



Here it is in the simulator:



enter image description here



Where am I going wrong here? I want to trigger the secondary intent and be able to get the location data of the user if they confirmed the use of it.










share|improve this question



























    1















    What's the correct way to chain from a permission intent to another with Dialogflow?



    I've got two intents setup:



    app.intent('ask_for_permission', async (conv) => {
    return conv.ask(new Permission({
    context: 'to get your location',
    permissions: 'DEVICE_PRECISE_LOCATION',
    }));
    })


    app.intent('confirm_permissions', async (conv, params, confirmationGranted) => {
    conv.ask(`I think you gave me permission? ${params} ${confirmationGranted}`)
    })


    And within the Dialogflow control panel I have it setup so the ask_for_permission intent follows on to the confirm_permissions intent like so:



    Dialogflow UI



    But whenever I trigger the ask_for_permission intent, the user gets asked if they want to share their location, but responding with either yes or no doesn't actually trigger the user to move onto the next intent.



    enter image description here



    Here it is in the simulator:



    enter image description here



    Where am I going wrong here? I want to trigger the secondary intent and be able to get the location data of the user if they confirmed the use of it.










    share|improve this question

























      1












      1








      1








      What's the correct way to chain from a permission intent to another with Dialogflow?



      I've got two intents setup:



      app.intent('ask_for_permission', async (conv) => {
      return conv.ask(new Permission({
      context: 'to get your location',
      permissions: 'DEVICE_PRECISE_LOCATION',
      }));
      })


      app.intent('confirm_permissions', async (conv, params, confirmationGranted) => {
      conv.ask(`I think you gave me permission? ${params} ${confirmationGranted}`)
      })


      And within the Dialogflow control panel I have it setup so the ask_for_permission intent follows on to the confirm_permissions intent like so:



      Dialogflow UI



      But whenever I trigger the ask_for_permission intent, the user gets asked if they want to share their location, but responding with either yes or no doesn't actually trigger the user to move onto the next intent.



      enter image description here



      Here it is in the simulator:



      enter image description here



      Where am I going wrong here? I want to trigger the secondary intent and be able to get the location data of the user if they confirmed the use of it.










      share|improve this question














      What's the correct way to chain from a permission intent to another with Dialogflow?



      I've got two intents setup:



      app.intent('ask_for_permission', async (conv) => {
      return conv.ask(new Permission({
      context: 'to get your location',
      permissions: 'DEVICE_PRECISE_LOCATION',
      }));
      })


      app.intent('confirm_permissions', async (conv, params, confirmationGranted) => {
      conv.ask(`I think you gave me permission? ${params} ${confirmationGranted}`)
      })


      And within the Dialogflow control panel I have it setup so the ask_for_permission intent follows on to the confirm_permissions intent like so:



      Dialogflow UI



      But whenever I trigger the ask_for_permission intent, the user gets asked if they want to share their location, but responding with either yes or no doesn't actually trigger the user to move onto the next intent.



      enter image description here



      Here it is in the simulator:



      enter image description here



      Where am I going wrong here? I want to trigger the secondary intent and be able to get the location data of the user if they confirmed the use of it.







      dialogflow actions-on-google






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 25 '18 at 17:25









      James IvesJames Ives

      1,87811535




      1,87811535
























          1 Answer
          1






          active

          oldest

          votes


















          1














          I think you're mixing up a few concepts here. It looks like your ask_for_permission Intent is triggering the Permission helper - that part seems fine.



          As part of this, you're setting a confirm_permissions context. A Context is different than an Intent. What you're saying by setting the Output Context the way you are is that you're in a state named "confirm_permissions", and Intents that should only be triggered in this state may be evaluated when processing responses.



          Instead, I think you want to create a confirm_permissions intent. In Dialogflow, the response will be an actions_intent_PERMISSION event, which you can create an Intent to handle. It might look something like this.



          enter image description here



          Of note here:




          • The name of the Intent is whatever you want it to be, just like other Intents.

          • The Event is the important bit, and must be set. This matches the name that is sent by Actions on Google as a special AoG Intent name (and replaces the periods with underscores).

          • Since we are specifying an Event, we do not use training phrases.

          • Don't forget to enable fulfillment.


          On the fulfillment side, your code looks like it should work.



          The reason you were getting the "Say that one more time" and similar replies is that these are from the Default Fallback Intent. Since no Intents were setup to match the permission Event, it used the Fallback Intent that was defined.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53469995%2fchaining-permission-intent%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I think you're mixing up a few concepts here. It looks like your ask_for_permission Intent is triggering the Permission helper - that part seems fine.



            As part of this, you're setting a confirm_permissions context. A Context is different than an Intent. What you're saying by setting the Output Context the way you are is that you're in a state named "confirm_permissions", and Intents that should only be triggered in this state may be evaluated when processing responses.



            Instead, I think you want to create a confirm_permissions intent. In Dialogflow, the response will be an actions_intent_PERMISSION event, which you can create an Intent to handle. It might look something like this.



            enter image description here



            Of note here:




            • The name of the Intent is whatever you want it to be, just like other Intents.

            • The Event is the important bit, and must be set. This matches the name that is sent by Actions on Google as a special AoG Intent name (and replaces the periods with underscores).

            • Since we are specifying an Event, we do not use training phrases.

            • Don't forget to enable fulfillment.


            On the fulfillment side, your code looks like it should work.



            The reason you were getting the "Say that one more time" and similar replies is that these are from the Default Fallback Intent. Since no Intents were setup to match the permission Event, it used the Fallback Intent that was defined.






            share|improve this answer




























              1














              I think you're mixing up a few concepts here. It looks like your ask_for_permission Intent is triggering the Permission helper - that part seems fine.



              As part of this, you're setting a confirm_permissions context. A Context is different than an Intent. What you're saying by setting the Output Context the way you are is that you're in a state named "confirm_permissions", and Intents that should only be triggered in this state may be evaluated when processing responses.



              Instead, I think you want to create a confirm_permissions intent. In Dialogflow, the response will be an actions_intent_PERMISSION event, which you can create an Intent to handle. It might look something like this.



              enter image description here



              Of note here:




              • The name of the Intent is whatever you want it to be, just like other Intents.

              • The Event is the important bit, and must be set. This matches the name that is sent by Actions on Google as a special AoG Intent name (and replaces the periods with underscores).

              • Since we are specifying an Event, we do not use training phrases.

              • Don't forget to enable fulfillment.


              On the fulfillment side, your code looks like it should work.



              The reason you were getting the "Say that one more time" and similar replies is that these are from the Default Fallback Intent. Since no Intents were setup to match the permission Event, it used the Fallback Intent that was defined.






              share|improve this answer


























                1












                1








                1







                I think you're mixing up a few concepts here. It looks like your ask_for_permission Intent is triggering the Permission helper - that part seems fine.



                As part of this, you're setting a confirm_permissions context. A Context is different than an Intent. What you're saying by setting the Output Context the way you are is that you're in a state named "confirm_permissions", and Intents that should only be triggered in this state may be evaluated when processing responses.



                Instead, I think you want to create a confirm_permissions intent. In Dialogflow, the response will be an actions_intent_PERMISSION event, which you can create an Intent to handle. It might look something like this.



                enter image description here



                Of note here:




                • The name of the Intent is whatever you want it to be, just like other Intents.

                • The Event is the important bit, and must be set. This matches the name that is sent by Actions on Google as a special AoG Intent name (and replaces the periods with underscores).

                • Since we are specifying an Event, we do not use training phrases.

                • Don't forget to enable fulfillment.


                On the fulfillment side, your code looks like it should work.



                The reason you were getting the "Say that one more time" and similar replies is that these are from the Default Fallback Intent. Since no Intents were setup to match the permission Event, it used the Fallback Intent that was defined.






                share|improve this answer













                I think you're mixing up a few concepts here. It looks like your ask_for_permission Intent is triggering the Permission helper - that part seems fine.



                As part of this, you're setting a confirm_permissions context. A Context is different than an Intent. What you're saying by setting the Output Context the way you are is that you're in a state named "confirm_permissions", and Intents that should only be triggered in this state may be evaluated when processing responses.



                Instead, I think you want to create a confirm_permissions intent. In Dialogflow, the response will be an actions_intent_PERMISSION event, which you can create an Intent to handle. It might look something like this.



                enter image description here



                Of note here:




                • The name of the Intent is whatever you want it to be, just like other Intents.

                • The Event is the important bit, and must be set. This matches the name that is sent by Actions on Google as a special AoG Intent name (and replaces the periods with underscores).

                • Since we are specifying an Event, we do not use training phrases.

                • Don't forget to enable fulfillment.


                On the fulfillment side, your code looks like it should work.



                The reason you were getting the "Say that one more time" and similar replies is that these are from the Default Fallback Intent. Since no Intents were setup to match the permission Event, it used the Fallback Intent that was defined.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 25 '18 at 18:03









                PrisonerPrisoner

                35.7k33361




                35.7k33361
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53469995%2fchaining-permission-intent%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    To store a contact into the json file from server.js file using a class in NodeJS

                    Marschland