Using the Google API

Hi,

I’m new to Kore.ai. I’m just trying to evaluate it and I want to use the google cloud platform api as a backend. I’m trying to create an information task that will return information about places. I need to construct an API query as follows:

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Museum%20of%20Contemporary%20Art%20Australia&inputtype=textquery&fields=photos,formatted_address,name,rating,opening_hours,geometry&key=YOUR_API_KEY

If I hard code this as the API request it works, but I’m struggling to do it using the parameters.

I’ve tried configuring as follows:
parameters

I don’t think it’s adding the parameters to the URL though. The response I get is:

{
“request”: {
“input”: “saint peters missouri hair dressers”,
“inputtype”: “textquery”
},
“labels”: {
“textquery”: “Text Query”,
“inputtype”: “Text Query”
},
tenant”: “”,
“response”: {
“candidates”: [],
“error_message”: “You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account”,
“status”: “REQUEST_DENIED”
},
“metainfo”: {
“Google Places”: {
“responseData”: {},
“fields”: [
{
“pathFields”: {
“input”: “saint peters missouri hair dressers”,
“inputtype”: “textquery”
},
“payloadFields”: {},
“headerFields”: {},
“idpFields”: [
“key”
]
}
],
“linkDefinition”: {
“endPoint”: {
“host”: “maps.googleapis.com”,
“port”: “”,
“path”: “/maps/api/place/findplacefromtext/json”,
“protocol”: “https”,
“content-type”: “application/json”,
“method”: “GET”,
“connectorEnabled”: false
},
“reqFields”: [
{
“name”: “Place Search String”,
“key”: “input”,
“type”: “queryfield”,
“subType”: “task”
},
{
“name”: “Input Type”,
“key”: “inputtype”,
“type”: “queryfield”,
“subType”: “task”
},
{
“name”: “AIzaSyDQPz7uaoL2eRJf-czWseJgUplIxcapqpM”,
“key”: “key”,
“type”: “querystring”,
“subType”: “auth”
}
],
“headerFields”: [],
“botVariables”: {},
“contentVariables”: {}
},
“name”: “Google Places”
}
}
}

Any help greatly appreciated.

I’m still trying to get this to work. I can pass parameters into the API query using {} and defined parameters, but I’m having to hard code the key - e.g.:

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?key=<hard_coding_my_key>&input={input}&inputtype={inputtype}&fields=name,photos,formatted_address

I’ve tried it with the key as a ‘query string’ and as a ‘path parameter’ but no luck.

Am I supposed to be hard coding this???

Did you try using bot variables?
Please refer https://developer.kore.ai/docs/bots/how-tos/how-to-use-global-variables/

No - not yet. Thanks, I’ll look into it. I can’t help feeling that auth is supposed to work using one of their predefined methods though …