What's the difference between ActionsSdkApp and DialogflowApp for Google Assistant

前端 未结 2 1081
被撕碎了的回忆
被撕碎了的回忆 2021-02-15 00:56

In order to build a Google Assistant app, Google provides two different APIs as part of their node.js actions-on-google library :

  • ActionsSdkApp
  • Dialogflow
2条回答
  •  庸人自扰
    2021-02-15 01:54

    In short, these two objects provide similar (although not identical) methods to handle requests and provide results for two default ways Google allows you to build an Action for the Assistant.

    The DialogflowApp object is the one you will likely use for most purposes. It is meant to work with the Dialogflow tool, letting it handle the Natural Language Processing (NLP) components and passing the results, where appropriate, to your webhook. It provides a few methods that are specific to Dialogflow features, such as Contexts, and maps other things to the response format that Dialogflow expects.

    The ActionsSdkApp is meant to be used if you are using your own NLP and your webhook is getting things directly from Google (without using Dialogflow). If you need to build an actions.json file, you're using the Actions SDK.

    Both have common methods and idioms, such as app.ask() and app.tell() and mapping app.data to session storage and so forth, even if the details of implementing these are different for each type.

    You should be using the one that matches the tool that you're using. For most new users - that will likely be Dialogflow and the DialogflowApp object.

    Update

    Note that the API in the question, the specific objects asked about, and the specific methods talked about in my answer are for the previous version of the library.

    The concept of when to use the ActionSDK vs Dialogflow objects in the current library still hold, so the concept behind this question and answer are still valid, but the technical details have changed.

    Update - Jun 2020

    The library in question is now deprecated, since it no longer works with the current version of Actions on Google (Actions Builder/SDK AoG v3). It still works with Dialogflow (which uses AoG v2) and if you're still using the AoG v2 Actions SDK.

提交回复
热议问题