api-ai

Webhook Global Variable

人走茶凉 提交于 2020-01-05 04:43:32
问题 I have created a node.js webhook for my facebook messenger bot. The bot is built in dialog flow and the database is connected to firebase. My question when a function is invoked in the webhook to log in, after logging in, I get a userID from the database, which I want to store it somewhere in the code so that userID info is available throughout the user session. I am storing it in a global variable. However, this works fine if only one user is using the bot. If another user is using the bot

Linking Google Assistant with Firebase Auth

拥有回忆 提交于 2019-12-21 04:23:08
问题 I am attempting to connect a Google Assistant app using DialogFlow(Api.AI) with Firebase Auth. My App uses Firebase Auth to maintain user accounts and the realtime database to store data. I would like to be able to make changes to a user's data through the Google Assistant, maybe using something like a cloud function. In order to make any user changes through Google Assistant, I need to link the user's Google Assistant account with their Firebase Auth account. The current mechanism appears to

API.AI: How to stop AsyncTask on click of the AIButton?

こ雲淡風輕ζ 提交于 2019-12-19 06:46:44
问题 I’m using AIButton in my app and I have a AsyncTask which gets executed after AIButton is clicked and receives some command and AsyncTask sometimes takes too long to execute. Here’s my code: final AIConfiguration config = new AIConfiguration("xxx", AIConfiguration.SupportedLanguages.English, AIConfiguration.RecognitionEngine.System); listenButton = (AIButton) findViewById(R.id.micButton); config.setRecognizerStartSound(getResources().openRawResourceFd(R.raw.test_start)); config

Api.ai request body does not contain the originalRequest object from which the access_token can be sent to the fulfillment webhook

喜欢而已 提交于 2019-12-13 21:41:18
问题 Api.ai request body does not contain the originalRequest object from which the access_token can be sent to the fulfillment webhook. Can anybody please let me know why I am not seeing the originalRequest body? I have successfully completed the Account Linking for my app and in fact, the actions web simulator does show the expected access_token in the debug window but the Api.ai json request body does not have it. I am using python for fulfillment logic. Any help on this is greatly appreciated.

Google agent authorization flow doesn't proceed after the grantType=authorization_code request

末鹿安然 提交于 2019-12-12 10:43:33
问题 I am developing a API AI agent, and trying to implement the account linking functionality. The documentation at oauth2-codeflow is really helpful and I am able to create my oauth flow and test the same in Google playground. It all works fine till here. But when I am trying to test it in the web simulator, I keep getting the "It looks like your Agent account is not linked yet". I've followed the debug URL and proceeded with the login and authorization steps. As per this SO Question: I should

Webhook response with “suggestion chips”

独自空忆成欢 提交于 2019-12-12 05:19:08
问题 I would like to guide users based on webhook response with suggestions chips. From webhook sample, I see below structure: "fulfillment": { "speech": "Today in Boston: Fair, the temperature is 37 F", "source": "apiai-weather-webhook-sample", "displayText": "Today in Boston: Fair, the temperature is 37 F" } But, if I want to suggest users what next you can request to continue the conversation, then how do I pass suggestions chips in webhook response? 回答1: The response you displayed is the basic

OAuth Implicit flow Access Token expires every hour

ぐ巨炮叔叔 提交于 2019-12-11 16:10:56
问题 I'm having a problem with the OAuth Implicit flow for the Google Assistant. I managed to set up a OAuth server and got it to work. Here's the flow: The user Is redirected to my endpoint, authenticates with a Google account, and gets send back to the Assistant with an Acces Token and result code=SUCCES. In my fullfilment I get the users email address by doing a https request to: https://www.googleapis.com/plus/v1/people/me?access_token=access_token . I then find the matching user in my

Send audio file to DialogFlow using Python

萝らか妹 提交于 2019-12-11 15:47:12
问题 I know that I can send data (Text in this case) to DialogFlow by using Python in the following way: ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN) request = ai.text_request() request.lang = 'de' # optional, default value equal 'en' request.session_id = "<SESSION ID, UNIQUE FOR EACH USER>" request.query = "Hello" response = request.getresponse() print (response.read()) But I'm not sure if I could send an audio file to DialogFlow, does anyone know about that? 回答1: There are two ways to use audio files

API.ai Actions on Google API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: “: Cannot find field.”

青春壹個敷衍的年華 提交于 2019-12-11 09:52:56
问题 I am using python to create webhook for Assistat app. I am able to ask user for location permission, but as soon as user gives consent, I receive following error UnparseableJsonResponse API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: ": Cannot find field.". I have checked my webhook server and no request comes to it. This looks like some issue at API.ai side. Below is the Debug response from Actions console when using Python client { "assistantToAgentDebug":

Force user to relink his/her account

狂风中的少年 提交于 2019-12-09 00:55:16
问题 Very simple use case explaining my problem: Given my app asks for a pin for some interactions. Now the user gives me three times a wrong pin. Then, I want to reset his access and force him to re-link his account. I can do this pretty easily in my internal database, but I need a way to tell google that his currently used token is not valid anymore. Else, Google Assistant resists in sending me the now rejected token. Update 2018-03-01 : With the new built-in intents/events, I also tried sending