Coder Social home page Coder Social logo

fulfillment-webhook-json's Introduction

Dialogflow Fulfillment Webhook JSON Sample

This sample shows Dialogflow's fulfillment webhook JSON requests and responses for v1 and v2 agents, including Actions on Google-specific responses/requests for rich responses (cards, lists, suggestions, etc.) and event (ask for name, location, sign in, etc.) as well as platform-agnostic request/response examples.

Setup Instructions

  1. Sign-up/Login to Google account
  2. Create a Firebase project
  3. Deploy the responses directory with Firebase hosting:
    • Follow the instructions to set up and initialize Firebase SDK for Cloud Functions. Make sure to select the project that you have previously generated in the Actions on Google Console and to reply N when asked to overwrite existing files by the Firebase CLI.
    • Run firebase deploy --only hosting and take note of the endpoint where the responses folder has been published. It should look like Hosting URL: https://${PROJECTID}.firebaseapp.com
  4. Select the correct JSON file for your Dialogflow fulfillment and take a note of the URL of the file (e.g. https://${PROJECTID}.firebaseapp.com/v2/ActionsOnGoogle/RichResponses/SimpleResponse.json)
  5. Go to the Dialogflow console and select Fulfillment from the left navigation menu.
  6. Enable Webhook > URL to the URL of the JSON file from the previous step, then select Save.
  7. Go to Intents from the left navigation menu and for every intent that you'd like to enable fulfillment for:
    • Select the intent
    • In Fulfillment > Enable Webhook call for this intent.

Issues & References

How to Make Contributions?

Please read and follow the steps in the CONTRIBUTING.md

License

See LICENSE.md

Terms

Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service and Dialogflow's Terms of Use and Privacy Policy.

fulfillment-webhook-json's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fulfillment-webhook-json's Issues

Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail

Hi, I cut and paste the example in the fulfillment inline editor but it does not connect with the firebase. I got the service account enabled.

On Dialogflow i get this error:
Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500.

On the firebase console I get Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail

Non English language issue in version2

Hello,
I am using version 2 while using Multi-linguistic feature of Dialogflow, I am facing some issues.
When I am trying to send a Fulfilment Request in Russian Language I am getting "?" instead of actual characters.

{
  "responseId": "9049029d-83a3-4e95-8baf-64cb91deefea",
  "queryResult": {
    "queryText": "?? ??????? ? ???-???? 5 ????",
    "parameters": {
      "from": "??????",
      "to": "???-????",
      "time": "2019-04-12T05:00:00+05:30"
    },
    "allRequiredParamsPresent": true,
    "fulfillmentText": "okk",
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "okk"
          ]
        }
      }
    ],
    "intent": {
      "name": "projects/flightquery-82f02/agent/intents/c032518b-f882-4f7f-a49b-fcf57155eeaf",
      "displayName": "bookFlight"
    },
    "intentDetectionConfidence": 1,
    "languageCode": "ru"
  },
  "originalDetectIntentRequest": {
    "payload": {}
  },
  "session": "projects/flightquery-82f02/agent/sessions/559a2540-07d1-fc35-4002-04d179f0b55f"
}

When I am doing the same in version 1, I am getting the Fulfilment request as desired in encoded in russian, in both the cases, I am not defining the charset header. Can we please fix this issue or is there a workaround to fix version 2 of Dialogflow for this issue?

Thanks!

Does not match "fulfillment_messages" format

When users create static rich responses for Action on Google in the DialogFlow console, these messages are translated into JSON and passed to the fulfillment webhook.

The format sent to the fulfillment webhook is completely different than what is displayed here, which is also completely different than what is displayed in the documentation (https://developers.google.com/actions/dialogflow/webhook).

If we can't get a Python SDK for connecting to Actions on Google through DialogFlow, can we at least get consistent advice on the JSON format to return? Other platform, such as Facebook Messenger, provide simple, clear documentation on the format.

Trailing comma in request.json

I'm trying to use the files in this repo as test fixtures and I'm hitting an issue parsing requests/v2/request.json. The following trailing comma is tripping my Json decoder (Jackson) as it goes against the JSON spec:

"parameters": {
  "param": "param value",
}

The error is:

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)): was expecting double-quote to start field name

Removing the comma fixes the issue.

Otherwise, thanks team for providing these files. It's great to have them as a resource while building a webhook.

Unable to detect custom Intents after importing from pre-built agent or after adding custom intent to a pre-built agent in Dialogflow

I'm trying build an api for a chatbot application which interacts with dialogflow.
I have implemented an api using the documentation(https://github.com/googleapis/nodejs-dialogflow).
I have manually created an agent in the dialogflow console and added some custom Intents.
It Worked fine when I tested with my api and the result was as expected. However I'm facing an issue in my diaogflow agent when
I have imported pre-built intents of small-talk(a pre-built agent ) which I exported prior to the import.
After the import the api no longer works for the custom intents which i created before importing small-talk intents.I was getting the default fallback response
But the imported small-talk intents are being detected.
Its works well the the dialogflow console UI though.

To try out something different I then Deleted my agent and created a pre-built agent.
I then added some custom intents to that pre-built agent.
Though the intents of prebuilt agent were detected, my custom intents were not detected through api. I was getting the default fallback response
Again it was working fine in the dialogflow console UI.

Just to make sure it not the fault of the dialogflow node js SDK , I implemented the api in java .But the result was same.

Am I missing any setting or configuration in dialogflow? or is this a bug?

Note : I have also tried importing with "Restore from zip" but it din't work
response _from_java

Ask for sign in Dialogflow API V2 doesn't work

My dialogflow agent is connected to a webhook for fulfillment using API v2, when I try to response back with ask for sign in response it doesn't perform the appropriate function and instead outputs the response from Fallback intent. Asking for permissions however work but asking for sign in never works, following is the body which I am outputting.

{
"payload": {
"google": {
"expectUserResponse": true,
"systemIntent": {
"intent": "actions.intent.SIGN_IN",
"data": {}
}
}
}
}

actions_intent_SIGN_IN doesn't have profile data under conv->user->profile

Hi, I am facing this issue in integrating Google SignIn flow. The problem I am facing is that after the user successfully sign in program control trigger actions_intent_SIGN_IN intent in the code. From where I can get user details but I am noticing that sometimes conv->user->profile doesn't have the profile information while other time it has. Also When it doesn't have profile information, next time when I invoke some other intent it gets the user token. I think this is a bug.

Access-Control-Allow-Origin

Failed to load.... No 'Access-Control-Allow-Origin' header is present on the requested resource.Therefore not allowed access. The response had HTTP status code 415.

Custom payload for platforms like Telegram, Facebook, Slack

Hi,

I would like to ask how to custom payload for carousel, image in other platforms like Facebook, Telegram and etc.

Information

DialogFlow API version: V2 API
Node version: v8.10.0
body-parser version: ^1.18.3
express: ^4.16.4

This is code snippet to return carousel response to Telegram and Google. It worked in google assistant but failed to display carousel list in Telegram. Only text "Category list" was displayed in Telegram.

return res.json({
          payload: {
            google: {
              expectUserResponse: true,
              systemIntent: {
                intent: "actions.intent.OPTION",
                data: {
                  "@type":
                    "type.googleapis.com/google.actions.v2.OptionValueSpec",
                  carouselSelect: {
                    items: [
                      {
                        optionInfo: {
                          key: "car",
                          synonyms: ["automobile", "vehicle"]
                        },
                        description: "A four wheel vehicle",
                        title: "Car"
                      },
                      {
                        optionInfo: {
                          key: "plane",
                          synonyms: ["aeroplane", "jet"]
                        },
                        description: "A flying machine",
                        title: "Plane"
                      }
                    ]
                  }
                }
              },
              richResponse: {
                items: [
                  {
                    simpleResponse: {
                      textToSpeech: "Category List"
                    }
                  }
                ]
              }
            },
            telegram: {
              text: "Category list",
              expectUserResponse: true,
              systemIntent: {
                intent: "actions.intent.OPTION",
                data: {
                  "@type":
                    "type.googleapis.com/google.actions.v2.OptionValueSpec",
                  carouselSelect: {
                    items: [
                      {
                        optionInfo: {
                          key: "car",
                          synonyms: ["automobile", "vehicle"]
                        },
                        description: "A four wheel vehicle",
                        title: "Car"
                      },
                      {
                        optionInfo: {
                          key: "plane",
                          synonyms: ["aeroplane", "jet"]
                        },
                        description: "A flying machine",
                        title: "Plane"
                      }
                    ]
                  }
                }
              }
            }
          },
          outputContexts: []
        });

Is there any mistake in the payload for Telegram?
Could anyone provide guidance on this?

Thanks in advanced.

Thank you.

Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.