Can i Use a normal HTTPS rest service for request / response for alexa, not using the alexa SDK - json

I am creating a normal HTTPS web-service to interact with Alexa. I am able to receive the request in the service and when i am returning response in the same structure as Alexa is expecting! i am getting an error. I am unable to get what's the problem.. the JSON body and Headers are set as per the standards. I am not using lambda, but trying to interact with Alexa with a normal HTTPS service.
Header:
HTTP/1.1 200 ok
content-type = application/json;charset=UTF-8
//Response JSON which is not been identified by alexa
{
"version": "1.0",
"sessionAttribute": {},
"response": {
"outputSpeech": {
"ssml": "<speak> Donut and Coffeee Aussie Style</speak>",
"type": "SSML"
},
"card": {
"content": "to the world",
"title": "Ava"
},
"speechletResponse": {
"outputSpeech": {
"ssml": "<speak>Donut and Coffee Aussie Style</speak>"
},
"card": {
"content": "to the world",
"title": "Ava"
},
"shouldEndSession": "true"
}
}
}

I found what was the problem with my response codes. The fields sessionAttributes speechletResponse are optional fields. The actual field which was missing in above JSON response is the type key value in card response. Even thought the card object itself is optional. If you are using it then you have to have a field called as type in the same. working json response below. Hope this helps the people who are trying to invade the alexa space.
{
"version": "1.0",
"sessionAttribute": {},
"response": {
"outputSpeech": {
"ssml": "<speak> Donut and Coffeee Aussie Style</speak>",
"type": "SSML"
},
"card": {
"type":"Standard",
"content": "to the world",
"title": "Ava"
},
"speechletResponse": {
"outputSpeech": {
"ssml": "<speak>Donut and Coffee Aussie Style</speak>"
},
"card": {
"content": "to the world",
"title": "Ava"
},
"shouldEndSession": "true"
}
}
}

Related

Why doesn't Autodesk Forge 'workflowAttribute' appear in webhook updates for Model Derivative work?

According to Forge API Reference, there is a workflowAttribute available to 'set some custom workflow information'. Its part of the misc object in the Body Structure of the POST request used to submit a job.
I am using the following request:
convertResponse = await axios({
method: "post",
url:
"https://developer.api.autodesk.com/modelderivative/v2/designdata/job",
headers: {
"Content-Type": "application/json",
Authorization: access_token
},
data: JSON.stringify({
input: { urn: url_safe_encoded_urn },
output: {
destination: { region: "us" },
formats: [
{
type: "svf",
views: ["2d", "3d"],
advanced: { generateMasterViews: true }
}
]
},
misc: {
workflow: "designgen-forge",
workflowAttribute: { projectId }
}
})
});
But when the webHook calls my callback function, I see nothing like hookAttribute available in the data:
{
"version": "1.0",
"resourceUrn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3VmZm9say1nZW5kZXNpZ25sb3ZlLWRldi10ZW1wLzkxZjhhNGZmLTM5NTYtNGM5Yi05NzkyLThiMWMxNDQyZGJkNyUyRnJldml0LTkxZjhhNGZmLTM5NTYtNGM5Yi05NzkyLThiMWMxNDQyZGJkNy5ydnQ",
"hook": {
"hookId": "6d770063-d5dc-4c66-8ed8-e84207ade07d",
"tenant": "designgen-forge",
"callbackUrl": "https://bigchief.ngrok.io/dev/workitemcomplete",
"createdBy": "9DqOEPqAd4ZZYQ2MAxuT2VQwMfAJrBGp",
"event": "extraction.updated",
"createdDate": "2020-10-20T20:14:31.874+0000",
"system": "derivative",
"creatorType": "Application",
"status": "active",
"scope": {
"workflow": "designgen-forge"
},
"urn": "urn:adsk.webhooks:events.hook:6d770063-d5dc-4c66-8ed8-e84207ade07d",
"__self__": "/systems/derivative/events/extraction.updated/hooks/6d770063-d5dc-4c66-8ed8-e84207ade07d"
},
"payload": {
"TimeStamp": 1603289180515,
"Env": "production",
"URN": "<my urn>",
"EventType": "UPDATED",
"Payload": {
"status": "inprogress",
"bubble": {
"guid": "<my guid>",
"owner": "<my guid>",
"hasThumbnail": "true",
"startedAt": "Wed Oct 21 14:05:39 UTC 2020",
"type": "design",
"urn": "<my urn>",
"success": "75%",
"progress": "50% complete",
"region": "US",
"status": "inprogress",
"children": []
},
"scope": "fd2d74bb-1d5a-407c-a344-20dffa327504",
"registerKey": []
}
}
}
I would imagine that is the intent of the workflowAttribute object to populate something in the callback data, otherwise, whats the point. Am I not specifying it correctly? Or is this not implemented? If not, webhooks become nearly unusable, I suppose the alternative is to make and destroy a webhook for each request, which is so ugly its not really a solution.
Thank you for bringing this to our attention. We could reproduce the issue as well - i.e. that the content of the workflowAttribute provided in the body of POST job request will not show up in the webhook callback.
It's being looked into, and I hope it will work soon, but I cannot yet provide a deadline for that.
In the meantime, the workaround could be either:
a) keep track of the extra data (in your case projectId) associated with the urn of the given file on the server or in a database (you might already be using one)
b) create separate webhooks, as you suggested, with different id for the "scope" -> "workflow" parameter and provide the data as the "hookAttribute" - that will show up in the callback
Update on 2020-12-14: it's working now - see https://forge.autodesk.com/blog/custom-data-translation-webhook

Autodesk Forge - Versions GET Downloads returns 400 "Request cannot be handled"

Making 2 and/or 3 legged auth request to Version/GetDownloads returns 400 when VersionId is valid and existing.
When trying to make an http call to a version's download endpoint (https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-downloads-GET/), the response returns:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a306d506-e374-4734-a68e-86c998fc7a5a",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request cannot be handled."
}
]
}
This would be ok if the Version Id didn't exist for the corresponding project, but requesting the version's download formats (https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-downloadFormats-GET/) returns a 200 response,
despite the version not having any download format:
{
"jsonapi": {
"version": "1.0"
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/{PROJECT_ID}/versions/{URN_VERSION_ID}/downloadFormats"
}
},
"data": {
"type": "downloadFormats",
"id": {URN_VERSION_ID},
"attributes": {
"formats": []
}
}
}
The file I am testing with is a pdf uploaded to BIM360 via the UI. I would have expected to get at least a 200 response on both endpoints. Also, I quite not understand why the downloadFormats endpoint does not return any format.

messages array issue on chatfuel Json api plugin : only text object sent but template not

I'm new on chatfuel bot platform.
I'm using json api plugin (As by documentation https://docs.chatfuel.com/api/json-api/json-api)
In my backend, I produce below json response for the plugin , this is my backend URL: http://185.206.145.26:12223/latestnews?locale=en_US&first%20name=John
{
"messages": [
{
"text": "Hi Fety! There are the latest news"
},
{
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"image_url": "http://scd.rfi.fr/sites/filesrfi/imagecache/rfi_43_medium/sites/images.rfi.fr/files/aef_image/2019-01-11t145823z_1912744290_rc1428cade00_rtrmadp_3_sudan-protests_0.jpg",
"title": "Soudan: les manifestations se poursuivent, la répression aussi",
"subtitle": "www.rfi.fr, 2019-01-12 04:03",
"buttons": [
{
"type": "web_url",
"url": "http://www.rfi.fr/afrique/20190112-soudan-manifestations-poursuivent-repression",
"title": "VOIR L'ARTICLE"
}
]
},
{
"image_url": "http://scd.rfi.fr/sites/filesrfi/imagecache/rfi_43_medium/sites/images.rfi.fr/files/aef_image/2019-01-11t182406z_855534608_rc1a370ea010_rtrmadp_3_usa-shutdown-lawsuit_0.jpg",
"title": "[Reportage] «Shutdown»: un quotidien compliqué pour des milliers d'employés",
"subtitle": "www.rfi.fr, 2019-01-12 04:01",
"buttons": [
{
"type": "web_url",
"url": "http://www.rfi.fr/ameriques/20190112-reportage-shutdown-quotidien-complique-800000-employes",
"title": "VOIR L'ARTICLE"
}
]
}
]
}
}
}
]
}
The problem is when I call this api from blocks, Only, the text object sent and not the case for attachment.I am sure that my json structure is ok but I have to missed some tricks on chatfuel.
Thank you!
I’m sitting on the couch right now but I’m pretty sure “attachments” is a component of a message, not a message. You’ve got it as a message object itself under the messages array.
Solution is to move it into the message object above, after “text”.

Implicit Invocation of Google Assistant Action App with DialogFlow not working

I'm getting the
"API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\"."
and so am hoping you can help me, as I cannot get Implicit Invoking working for my app.
I've attached screenshots of the Welcome Intent setup on DialogFLow as well as pasted the Google Cloud fail logs here:
Google Cloud FAIL LOGS:
{
"request": {
"conversationToken": "",
"debugLevel": 1,
"inputType": "KEYBOARD",
"locale": "en-US",
"mockLocation": {
"city": "Mountain View",
"coordinates": {
"latitude": 37.421980615353675,
"longitude": -122.08419799804688
},
"formattedAddress": "Googleplex, Mountain View, CA 94043, United States",
"zipCode": "94043"
},
"query": "ask follow-up to log a call",
"surface": "GOOGLE_HOME"
},
"response": {
"conversationToken": "GidzaW11bG...",
"response": "Follow up isn't responding right now. Try again soon.",
"visualResponse": {
"visualElements": []
}
},
"debug": {
"agentToAssistantDebug": {
"agentToAssistantJson": "{\"message\":\"Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response\",\"apiResponse\":{\"id\":\"875b123f-bcb2-4f45-b2f4-10193a6132c3\",\"timestamp\":\"2018-01-30T06:33:52.773Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1517294032097\"}}"
},
"assistantToAgentDebug": {
"assistantToAgentJson": "{\"user\":{\"userId\":\"ABwppHHDarg-rpyAaSt0hm8TZaycr30xhUpQcRKfchRbXriPUKmmzi_BqQrpXInBGyGmgfF4yIEiMX0jInJ8rQ\",\"accessToken\":\"{\\\"access_token\\\":\\\"00D3600000uHY5!AQoAQAcyjXEI.J.5EnB4.R.EdNXBKlymGOI4I6PPJVb465uyQLxnbQDyjPHtD0uE0W1RMdhnhgXLEpr8qPIMOTcnvsfKH0j\\\",\\\"signature\\\":\\\"etNbI3erh1iYmsTqCRicfKKJknRtGnCb1esvufdg7g=\\\",\\\"scope\\\":\\\"refresh_token web api\\\",\\\"instance_url\\\":\\\"https://follow-up-ed.my.salesforce.com\\\",\\\"id\\\":\\\"https://login.salesforce.com/id/00D3600000uHY5EAM/0053600000L9ePAAS\\\",\\\"token_type\\\":\\\"Bearer\\\",\\\"issued_at\\\":\\\"1517293582207\\\"}\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-30T06:26:14Z\"},\"conversation\":{\"conversationId\":\"151729432097\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"Log Call by Business\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"ask follow-up to log a call\"}],\"arguments\":[{\"name\":\"trigger_query\",\"rawText\":\"log a call\",\"textValue\":\"log a call\"},{\"name\":\"Type\",\"rawText\":\"call\",\"textValue\":\"call\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}",
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=1ee421e5c9504f5b995ce9df62f7d275' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjI2YzAxOGIyMzNmZTJlZWY0N2ZlZGJiZGQ5Mzk4MTcwZmM5YjI5ZDgifQ.eyJhdWQiOiJzYWxlc2ZvcmNlLWEwOWVkIiwiYXpwIjoiMTE4NDUyMTUyMjE5LW1zZ2VldXBkaGU5YWp0MzZpNnJxbHJtdTExZGQ1Y2gyLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZXhwIjoxNTE3Mjk0MTUyLCJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJqdGkiOiI5ZTJjOGI1OGQzZjRiNTc3MmQ0MDc2ZjIwNWIyMGEyYTdmYTQ3MGY3IiwiaWF0IjoxNTE3Mjk0MDMyLCJuYmYiOjE1MTcyOTM3MzJ9.WnIVnDFUESVaLYOITacgDzS_4qPCat8YEMTHgsSzvHUzJNNeZ3oaDqUZ5lwECI0jfp2qHpW7Il5Tv1iDyPScOeggvm2cZZa4OXdr7PLr362eT5wyOZnsFWlrU8n4KlNZsuKl_uMSxhftP0qD2eUuwAKQ0bbAPurApTF_iY8Gzh2V0QYpn1Ol06bJLJo8B9z4lXmFuGfzldjWXojQ1eA794nItQKtt2X7tiSfBOoXOL2fpT8omy293vcMI-dWtf5FY1nH9_bN1GKHCbOQ4LiJTB__r7PVHOcq-SNb9_CtKaXvrLo9EW3CyfnHlc0SGv1UUo9akbvDZEwZG9B3gH7K1g' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"ABwppHHDarg-rpyAaSt0hm8TZaycr30xhUpQcRKfchRbXriPUKmmzi_BqQrpXInBGyGmgfF4yIEiMX0jInJ8rQ\",\"accessToken\":\"{\\\"access_token\\\":\\\"00D36000000uHY5!AQoAQAcyjXEI.J.5EnB4.R.EdNXBKlymGOI4I6PPJVb465uyQLxnbQDyjPHtD0uE0W1RMdhnhgXL8Epr8qPIMOTcnvsfKH0j\\\",\\\"signature\\\":\\\"etNbI3erh1iYmsTqCRicfKKJknRtGnC4b1esvufdg7g=\\\",\\\"scope\\\":\\\"refresh_token web api\\\",\\\"instance_url\\\":\\\"https://follow-up-dev-ed.my.salesforce.com\\\",\\\"id\\\":\\\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\\\",\\\"token_type\\\":\\\"Bearer\\\",\\\"issued_at\\\":\\\"1517293582207\\\"}\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-30T06:26:14Z\"},\"conversation\":{\"conversationId\":\"1517294032097\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"Log Call by Business\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"ask follow-up to log a call\"}],\"arguments\":[{\"name\":\"trigger_query\",\"rawText\":\"log a call\",\"textValue\":\"log a call\"},{\"name\":\"Type\",\"rawText\":\"call\",\"textValue\":\"call\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'"
},
"sharedDebugInfo": [
{
"name": "ResponseValidation",
"subDebugEntry": [
{
"debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
"name": "UnparseableJsonResponse"
}
]
}
]
},
"errors": [
[
{
"debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
"name": "UnparseableJsonResponse"
}
]
]
}
Google Cloud SUCCESS LOGS:
{
"request": {
"conversationToken": "",
"debugLevel": 1,
"inputType": "KEYBOARD",
"locale": "en-US",
"mockLocation": {
"city": "Mountain View",
"coordinates": {
"latitude": 37.421980615353675,
"longitude": -122.08419799804688
},
"formattedAddress": "Googleplex, Mountain View, CA 94043, United States",
"zipCode": "94043"
},
"query": "Talk to Follow-Up",
"surface": "GOOGLE_HOME"
},
"response": {
"conversationToken": "CiZDIzVhNm...",
"expectUserResponse": true,
"response": "Follow-Up is Online. Would you like to log a call, add a note or create a reminder?",
"visualResponse": {
"visualElements": []
}
},
"debug": {
"agentToAssistantDebug": {
"agentToAssistantJson": "{\"conversationToken\":\"[\\\"defaultwelcomeintent-followup\\\",\\\"sessiondata\\\"]\",\"expectUserResponse\":true,\"expectedInputs\":[{\"inputPrompt\":{\"richInitialPrompt\":{\"items\":[{\"simpleResponse\":{\"textToSpeech\":\"Follow-Up is Online. Would you like to log a call, add a note or create a reminder?\",\"displayText\":\"Follow-Up is Online. Would you like to log a call, add a note or create a reminder in Salesforce?\"}}],\"suggestions\":[{\"title\":\"Log a call\"},{\"title\":\"Add a note\"},{\"title\":\"Create a reminder\"},{\"title\":\"Exit\"}]}},\"possibleIntents\":[{\"intent\":\"assistant.intent.action.TEXT\"},{\"intent\":\"907faabf-33a2-49ff-a368-263d01e812fc\"},{\"intent\":\"a4bdf329-5430-4833-827d-620ed00e4288\"},{\"intent\":\"68d2be51-880d-44dd-9939-1c09089b5fbf\"},{\"intent\":\"d9f56992-363e-410d-a00e-1e9a59ed613d\"},{\"intent\":\"66de3f32-c11a-4e36-80b1-64582bc1ef69\"},{\"intent\":\"befff469-3348-49d7-b9d6-5bbe7eef2aa6\"},{\"intent\":\"a813eeba-2a35-4f20-8fdb-09f8e9b08b7c\"},{\"intent\":\"e9add01c-1067-4c14-a48c-979f4934e192\"},{\"intent\":\"1dbe2f1a-a12e-4f22-9092-11dafce0cf26\"},{\"intent\":\"94c36f7f-8fff-4c55-b6f4-f5556fa83d8a\"},{\"intent\":\"d503d957-6dea-4d40-b161-adb779df2f66\"},{\"intent\":\"040b1388-4aaa-4e3b-8af9-67c111bd9cc7\"},{\"intent\":\"494afd87-d03a-49a6-a5da-340061c9121a\"}],\"speechBiasingHints\":[\"$Classification\",\"$Type\",\"$BusinessName\",\"$Task\",\"$FollowUp\",\"$Calendar\"]}],\"responseMetadata\":{\"status\":{},\"queryMatchInfo\":{\"queryMatched\":true,\"intent\":\"6bb1ee8e-8a54-4422-b20e-de50839c40bc\"}}}"
},
"assistantToAgentDebug": {
"assistantToAgentJson": "{\"user\":{\"userId\":\"ABwppHHDarg-rpyAaSt0hm8TZaycr30xhUpQcRKfchRbXriPUKmmzi_BqQrpXInBGyGmgfF4yIEiMX0jInJ8rQ\",\"accessToken\":\"{\\\"access_token\\\":\\\"00D36000000uHY5!AQoAQAcyjXEI.J.5EnB4.R.EdNXBKlymGOI4I6PPJVb465uyQLxnbQDyjPHtD0uE0W1RMdhnhgXL8Epr8qPIMOTcnvsfKH0j\\\",\\\"signature\\\":\\\"etNbI3erh1iYmsTqCRicfKKJknRtGnC4b1esvufdg7g=\\\",\\\"scope\\\":\\\"refresh_token web api\\\",\\\"instance_url\\\":\\\"https://follow-up-dev-ed.my.salesforce.com\\\",\\\"id\\\":\\\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\\\",\\\"token_type\\\":\\\"Bearer\\\",\\\"issued_at\\\":\\\"1517293582207\\\"}\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-30T06:33:52Z\"},\"conversation\":{\"conversationId\":\"1517294128019\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"Talk to Follow-Up\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]}]}",
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=1ee421e5c9504f5b995ce9df62f7d275' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjI2YzAxOGIyMzNmZTJlZWY0N2ZlZGJiZGQ5Mzk4MTcwZmM5YjI5ZDgifQ.eyJhdWQiOiJzYWxlc2ZvcmNlLWEwOWVkIiwiYXpwIjoiMTE4NDUyMTUyMjE5LW1zZ2VldXBkaGU5YWp0MzZpNnJxbHJtdTExZGQ1Y2gyLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZXhwIjoxNTE3Mjk0MjQ4LCJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJqdGkiOiIxY2M5ODYxOGVlNzI5NzQ4YjdiZTczZmI3NjY2ZDM3YzllYjk0ZDQ4IiwiaWF0IjoxNTE3Mjk0MTI4LCJuYmYiOjE1MTcyOTM4Mjh9.S28YQqlVGJEK0xXfgZ-rxgwdXlfBMBoV3UXBIsvN6SeKK3PYvkvShqpKB5Icr89TSvzS7riq2H9YBwzrvPCRQscrH_3tVRyQL2EsCQhnpGQhnvVdO7rwE2b1-xnoAj7dy9D8EOuNskOK7V2Qek7u-_ZdU9r7w4W_saVwhyFtGMjfXFjgPgRurZq3Ei3-fnZ9GJ-3RqlgGU8FiSSFXheBgSvwWq9Ai7QeiVDaGcjxovX1qZXhkhu9W5lPPdTE1tUYVZ3CZcJfE5YqQiPJfQj6OJwguRg5Qb3aKMHlBV50Pb5Ux302ZWT_L49lVxk-cFM0-oTeNo5YLuFzQIwCgpcaoA' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"ABwppHHDarg-rpyAaSt0hm8TZaycr30xhUpQcRKfchRbXriPUKmmzi_BqQrpXInBGyGmgfF4yIEiMX0jInJ8rQ\",\"accessToken\":\"{\\\"access_token\\\":\\\"00D36000000uHY5!AQoAQAcyjXEI.J.5EnB4.R.EdNXBKlymGOI4I6PPJVb465uyQLxnbQDyjPHtD0uE0W1RMdhnhgXL8Epr8qPIMOTcnvsfKH0j\\\",\\\"signature\\\":\\\"etNbI3erh1iYmsTqCRicfKKJknRtGnC4b1esvufdg7g=\\\",\\\"scope\\\":\\\"refresh_token web api\\\",\\\"instance_url\\\":\\\"https://follow-up-dev-ed.my.salesforce.com\\\",\\\"id\\\":\\\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\\\",\\\"token_type\\\":\\\"Bearer\\\",\\\"issued_at\\\":\\\"1517293582207\\\"}\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-30T06:33:52Z\"},\"conversation\":{\"conversationId\":\"1517294128019\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"Talk to Follow-Up\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]}]}'"
}
},
"errors": []
}
And the DialogFLow JSON blob here:
FAIL DIALOGFLOW
{
"id": "60acafcf-ceb2-485c-b3f6-663407832e1c",
"timestamp": "2018-01-30T06:39:56.632Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "ask follow up to log a call",
"action": "input.welcome",
"actionIncomplete": false,
"parameters": {},
"contexts": [
{
"name": "defaultwelcomeintent-followup",
"parameters": {},
"lifespan": 2
},
{
"name": "sessiondata",
"parameters": {},
"lifespan": 1
}
],
"metadata": {
"intentId": "6bb1ee8e-8a54-4422-b20e-de50839c40bc",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 340,
"intentName": "Default Welcome Intent"
},
"fulfillment": {
"messages": [
{
"type": "suggestion_chips",
"platform": "google",
"suggestions": [
{
"title": "\"Log a call\""
},
{
"title": "\"Add a note\""
},
{
"title": "\"Create a reminder\""
}
]
},
{
"type": 0,
"speech": "Follow-Up isn't responding right now. Please try again later."
}
]
},
"score": 0.5
},
"status": {
"code": 200,
"errorType": "success",
"webhookTimedOut": false
},
"sessionId": "24069c06-d6c0-4723-a0d9-fa284884d023"
}
SUCCESS DIALOGFLOW
{
"id": "210514e2-6702-4d30-9689-eb3279fdde6d",
"timestamp": "2018-01-30T06:41:19.848Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "talk to follow up",
"action": "input.welcome",
"actionIncomplete": false,
"parameters": {},
"contexts": [
{
"name": "defaultwelcomeintent-followup",
"parameters": {},
"lifespan": 2
},
{
"name": "sessiondata",
"parameters": {},
"lifespan": 1
}
],
"metadata": {
"intentId": "6bb1ee8e-8a54-4422-b20e-de50839c40bc",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 237,
"intentName": "Default Welcome Intent"
},
"fulfillment": {
"messages": [
{
"type": "suggestion_chips",
"platform": "google",
"suggestions": [
{
"title": "\"Log a call\""
},
{
"title": "\"Add a note\""
},
{
"title": "\"Create a reminder\""
}
]
},
{
"type": 0,
"speech": "Follow-Up isn't responding right now. Please try again later."
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success",
"webhookTimedOut": false
},
"sessionId": "24069c06-d6c0-4723-a0d9-fa284884d023"
}
Google Actions Testing Logs FAIL
{
"request": {
"conversationToken": "",
"debugLevel": 1,
"inputType": "KEYBOARD",
"locale": "en-US",
"mockLocation": {
"city": "Mountain View",
"coordinates": {
"latitude": 37.421980615353675,
"longitude": -122.08419799804688
},
"formattedAddress": "Googleplex, Mountain View, CA 94043, United States",
"zipCode": "94043"
},
"query": "ask follow up to log a call",
"surface": "GOOGLE_HOME"
},
"response": {
"conversationToken": "GidzaW11bG...",
"response": "Follow up isn't responding right now. Try again soon.",
"visualResponse": {
"visualElements": []
}
},
"debug": {
"agentToAssistantDebug": {
"agentToAssistantJson": "{\"message\":\"Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response\",\"apiResponse\":{\"id\":\"49c16313-09e6-4431-9765-37095a19e3bb\",\"timestamp\":\"2018-01-31T01:45:41.734Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1517363140452\"}}"
},
"assistantToAgentDebug": {
"assistantToAgentJson": "{\"user\":{\"userId\":\"ABwppHGKOxCmVg53MPiRI_5NnIt0vUjDf0Hqwxgm9pTNnH8vOquUymEX8T2OtFC1NA48-X4JiKBTk0an2wTYVw\",\"accessToken\":\"{\\\"access_token\\\":\\\"00D36000000uHY5!AQoAQFHFHGAYHInuT1.FtcUSN7k81w1tgkEh.ijyqq1Pw3UqtlCM6SGi_qTrvFDAvPBG673Lgr119bpIUEUNuOnC4XF2d7o2\\\",\\\"refresh_token\\\":\\\"5Aep861QbHyftz0nI9mDOXbILtyhnTRY2lNmFwvaIHwc6w_JBasCpmEoOoWUo5W9asHeibIB9HbomiclZ2P_6pk\\\",\\\"signature\\\":\\\"nUZJxL8SFUVOScLjP6c5ydpjwL8iLRyHZ+xOyehfLhc=\\\",\\\"scope\\\":\\\"refresh_token web api\\\",\\\"instance_url\\\":\\\"https://follow-up-dev-ed.my.salesforce.com\\\",\\\"id\\\":\\\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\\\",\\\"token_type\\\":\\\"Bearer\\\",\\\"issued_at\\\":\\\"1517363133651\\\"}\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-31T01:44:48Z\"},\"conversation\":{\"conversationId\":\"1517363140452\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"Log Call by Name\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"ask follow up to log a call\"}],\"arguments\":[{\"name\":\"trigger_query\",\"rawText\":\"log a call\",\"textValue\":\"log a call\"},{\"name\":\"Type\",\"rawText\":\"call\",\"textValue\":\"call\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]}]}",
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=1ee421e5c9504f5b995ce9df62f7d275' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjI2YzAxOGIyMzNmZTJlZWY0N2ZlZGJiZGQ5Mzk4MTcwZmM5YjI5ZDgifQ.eyJhdWQiOiJzYWxlc2ZvcmNlLWEwOWVkIiwiYXpwIjoiMTE4NDUyMTUyMjE5LW1zZ2VldXBkaGU5YWp0MzZpNnJxbHJtdTExZGQ1Y2gyLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZXhwIjoxNTE3MzYzMjYwLCJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJqdGkiOiI5NDQxOTU4YzVkYWY3ZjgyODkzOTdhYWRkNjgzMzNmNDQ1ZjY2NDFkIiwiaWF0IjoxNTE3MzYzMTQwLCJuYmYiOjE1MTczNjI4NDB9.Fc5SWQakdTwfhW3x1NGgbwzT4pjec5GW2fOVc0Vh9aZ8XseAOeMWDRdiVK5Q4ApRMfJWC239P2LYvXGzW2tqZBPjxS_LKdD_6GbRJaNAYMs2SyiTuJmLs0G9RqFzXja-0mz8q_lejpWSuLgjzO7H136lHjR4d6bFiNS0ec3UIzIrgx7oaGCtRFuEtj4af82llyztaKkDAtwpankG01CBWm_sX_FmFD9svLUk7u22NA3KXsCM23fasLcmietBEj6LktnfiR6Tk85mk4n5FYi4VJ7KHzsfgIPC2zkmJVaAc1OczLvV_qtLb_9hoM_3k8jLMXK0n1oypQHZSpCvElOzwQ' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"ABwppHGKOxCmVg53MPiRI_5NnIt0vUjDf0Hqwxgm9pTNnH8vOquUymEX8T2OtFC1NA48-X4JiKBTk0an2wTYVw\",\"accessToken\":\"{\\\"access_token\\\":\\\"00D36000000uHY5!AQoAQFHFHGAYHInuT1.FtcUSN7k81w1tgkEh.ijyqq1Pw3UqtlCM6SGi_qTrvFDAvPBG673Lgr119bpIUEUNuOnC4XF2d7o2\\\",\\\"refresh_token\\\":\\\"5Aep861QbHyftz0nI9mDOXbILtyhnTRY2lNmFwvaIHwc6w_JBasCpmEoOoWUo5W9asHeibIB9HbomiclZ2P_6pk\\\",\\\"signature\\\":\\\"nUZJxL8SFUVOScLjP6c5ydpjwL8iLRyHZ+xOyehfLhc=\\\",\\\"scope\\\":\\\"refresh_token web api\\\",\\\"instance_url\\\":\\\"https://follow-up-dev-ed.my.salesforce.com\\\",\\\"id\\\":\\\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\\\",\\\"token_type\\\":\\\"Bearer\\\",\\\"issued_at\\\":\\\"1517363133651\\\"}\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-31T01:44:48Z\"},\"conversation\":{\"conversationId\":\"1517363140452\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"Log Call by Name\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"ask follow up to log a call\"}],\"arguments\":[{\"name\":\"trigger_query\",\"rawText\":\"log a call\",\"textValue\":\"log a call\"},{\"name\":\"Type\",\"rawText\":\"call\",\"textValue\":\"call\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]}]}'"
},
"sharedDebugInfo": [
{
"name": "ResponseValidation",
"subDebugEntry": [
{
"debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
"name": "UnparseableJsonResponse"
}
]
}
]
},
"errors": [
[
{
"debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
"name": "UnparseableJsonResponse"
}
]
]
}
Google Cloud Logs SUCCESS Post
{
insertId: "epw74xfuhr98a"
labels: {
channel: "preview"
source: "JSON_RESPONSE_VALIDATION"
}
logName: "projects/salesforce-a09ed/logs/actions.googleapis.com%2Factions"
receiveTimestamp: "2018-01-31T02:07:08.026897050Z"
resource: {
labels: {
action_id: ""
project_id: "salesforce-a09ed"
version_id: ""
}
type: "assistant_action"
}
severity: "DEBUG"
textPayload: "Sending request with post data: {"user":{"userId":"ABwppHGKOxCmVg53MPiRI_5NnIt0vUjDf0Hqwxgm9pTNnH8vOquUymEX8T2OtFC1NA48-X4JiKBTk0an2wTYVw","accessToken":"{\"access_token\":\"00D36000000uHY5!AQoAQPlRWyuv4mA0oNyUUcUWBr1PRzsaQB0NGFR3f9CD6j4Z_vHGSHCcRtGyOet5F_jEdvo.ykj1es.d2y.d7lFwanc1x1en\",\"refresh_token\":\"5Aep861QbHyftz0nI9mDOXbILtyhnTRY2lNmFwvaIHwc6w_JBZrL0KU0BZ3nLp.5Q1bBdSVn.zL53m3QsG0ZW1J\",\"signature\":\"UncpON0wsMm9OfoudbJw4liWBdWktyCat6lxArAO3iU=\",\"scope\":\"refresh_token web api\",\"instance_url\":\"https://follow-up-dev-ed.my.salesforce.com\",\"id\":\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\",\"token_type\":\"Bearer\",\"issued_at\":\"1517364271309\"}","locale":"en-US","lastSeen":"2018-01-31T02:05:39Z"},"conversation":{"conversationId":"1517364426179","type":"NEW"},
"inputs":[{"intent":"actions.intent.MAIN","rawInputs":[{"inputType":"VOICE","query":"open follow-up"}]}],
"surface":{"capabilities":[{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.AUDIO_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.SCREEN_OUTPUT"},{"name":"actions.capability.AUDIO_OUTPUT"}]}]}."
timestamp: "2018-01-31T02:07:06.435444389Z"
trace: "projects/118452152219/traces/1517364426179"
}
Google Cloud Logs FAIL Post
{
insertId: "5kahhnfa51fzb"
labels: {
channel: "preview"
source: "JSON_RESPONSE_VALIDATION"
}
logName: "projects/salesforce-a09ed/logs/actions.googleapis.com%2Factions"
receiveTimestamp: "2018-01-31T02:08:18.510485438Z"
resource: {
labels: {
action_id: ""
project_id: "salesforce-a09ed"
version_id: ""
}
type: "assistant_action"
}
severity: "DEBUG"
textPayload: "Sending request with post data: {"user":{"userId":"ABwppHGKOxCmVg53MPiRI_5NnIt0vUjDf0Hqwxgm9pTNnH8vOquUymEX8T2OtFC1NA48-X4JiKBTk0an2wTYVw","accessToken":"{\"access_token\":\"00D36000000uHY5!AQoAQPlRWyuv4mA0oNyUUcUWBr1PRzsaQB0NGFR3f9CD6j4Z_vHGSHCcRtGyOet5F_jEdvo.ykj1es.d2y.d7lFwanc1x1en\",\"refresh_token\":\"5Aep861QbHyftz0nI9mDOXbILtyhnTRY2lNmFwvaIHwc6w_JBZrL0KU0BZ3nLp.5Q1bBdSVn.zL53m3QsG0ZW1J\",\"signature\":\"UncpON0wsMm9OfoudbJw4liWBdWktyCat6lxArAO3iU=\",\"scope\":\"refresh_token web api\",\"instance_url\":\"https://follow-up-dev-ed.my.salesforce.com\",\"id\":\"https://login.salesforce.com/id/00D36000000uHY5EAM/00536000000L9ePAAS\",\"token_type\":\"Bearer\",\"issued_at\":\"1517364271309\"}","locale":"en-US","lastSeen":"2018-01-31T02:08:07Z"},"conversation":{"conversationId":"1517364498025","type":"NEW"},
"inputs":[{"intent":"ReminderIntent","rawInputs":[{"inputType":"VOICE","query":"ask follow up to create a reminder"}],"arguments":[{"name":"trigger_query","rawText":"create a reminder","textValue":"create a reminder"},{"name":"Task","rawText":"creates","textValue":"create"},{"name":"Task","rawText":"reminders","textValue":"reminder"}]}],
"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.SCREEN_OUTPUT"}]}]}."
timestamp: "2018-01-31T02:08:18.282416932Z"
trace: "projects/118452152219/traces/1517364498025"
}
Screen shots:
DialogFlow Welcome Intent
DialogFlow LogCall Intent
DialogFlow / Assistant Integration Tab
Google Actions Simulator error
Google Cloud Error Logs
The issue is because the intent you are trying to match "Log call by name" which expects an input context "sessionData", will never be matched because invoking your app using a deep-link "ask follow up to log a call" doesn't send that context in the request. That explains why your default response (Text response) for that intent isn't returned.
To fix it you need to:
Remove the input contexts from the intents you intend to use as deep-links OR duplicate those intents and remove the input contexts from the duplicates.
Best practice 1: Have a fallback intent that has no input contexts, which will catch any unmatched in-dialog queries.
Best practice 2: Have a fallback intent that specifically handles unmatched deep-links at invocation time. (See image below)
The agentToAssistantJson field has an encoded JSON entry for result which typically suggests that your webhook isn't returning anything. Normally, Dialogflow returns the static messages you've defined in the Intent in this case, but it sounds like that isn't happening here. Verify that the URL you're using for fulfillment is correct and that it is returning valid JSON.
In this case, I think there are a few things that could be causing the problem.
The phrase "Ask follow up to log a call" should be triggering the Log Call by Name Intent it looks like. But this Intent isn't listed as one of the implicit invocation Intents. The Assistant might be passing this off to Dialogflow, and Dialogflow, finding no match, returns nothing.
But even if it did match the phrasing for the Log Call by Name Intent, and that Intent was an implicit invocation Intent, there are two other elements of the Intent that seem strange.
The first is that the Intent is expecting an input context of sessionData. But since this is meant to be used as an initial Intent, there can be no input context. Dialogflow may be told by the Assistant that this is the matching Intent, and then reject it because the input context doesn't match.
Similarly, the second oddity is that you're looking for an event called CALL_BY_NAME. Events generally override any phrases that may be spoken - they're meant to capture non-textual activities (the WELCOME intent, for example, or an option being selected, or the user saying nothing). Unless you're triggering the event (which you can do), you probably wouldn't want it. As above, I'm wondering if the Assistant is telling Dialogflow this is the Intent to use, but Dialogflow isn't getting the event, so rejects it and sends back nothing.
tl;dr
There are three possible things to look at and fix:
Make sure the Intent is listed as an implicit invocation Intent in the Assistant Integration.
Remove the incoming context.
Remove the event.

What is the best practice for referencing JSON Schema for your state representations in REST?

Let's say I have a REST end point that allows customers to POST a new Article. Its URL is http://api.example.com/articles. I also have an end point that they can GET a previously posted Article. Its URL is http://api.example.com/articles/{articleId}
The state representation for an article is like so.
{
"title": "Some title",
"body": "Article body"
}
So a raw POST request:-
POST http://api.example.com/articles HTTP/1.1
Content-Type: application/vnd.example.com.article+json
Host: api.example.com
Content-Length: 76
{
"title": "Some title",
"body": "Article body"
}
A raw GET request:-
GET http://api.example.com/articles/dfgh HTTP/1.1
Accept: application/vnd.example.com.article+json
Host: api.example.com
Now I have taken the time to provide a JSON Schema schema to describe my article state representation. Hosted at http://spec.api.example.com/article.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"title": {
"type": "string"
},
"body": {
"type": "string"
}
},
"required": [
"title",
"body"
]
}
What is the best practise for making this documentation available to the customer for both GET and POST requests of this type?
The best way to document how to make a request is to use some hypermedia format to express it. My personal preference is JSON Hyper-Schema and since you are already using JSON Schema, it's a natural fit.
A link to create an article would look like this.
{
"rel": "create",
"href": "/articles",
"method": "post",
"schema": { "$ref": "http://spec.api.example.com/article.json" }
}
So, the next step is to determine how to expose this link description object (LDO). The answer to that depends on the flow of your API, but here are a couple common options.
The API's Entry Point
GET http://api.example.com/
HTTP/1.1 200 OK
Link: <http://spec.api.example.com/index.json>; rel=describedby
...
GET http://spec.api.example.com/index.json
HTTP/1.1 200 OK
{
"links": [
{
"rel": "create",
"href": "/articles",
"method": "post",
"schema": { "$ref": "http://spec.api.example.com/article.json" }
}
]
}
The article listing resource
GET http://api.example.com/articles
HTTP/1.1 200 OK
Link: <http://spec.api.example.com/articles.json>; rel=describedby
[
{
"title": "Some title",
"body": "Article body"
},
{
"title": "Another title",
"body": "Article body"
}
]
GET http://spec.api.example.com/articles.json
HTTP/1.1 200 OK
{
"type": "array",
"items": { "$ref": "http://spec.api.example.com/article.json" },
"links": [
{
"rel": "create",
"href": "/articles",
"method": "post",
"schema": { "$ref": "http://spec.api.example.com/article.json" }
}
]
}
An other notation for REST APIs is RAML. It uses YAML for describing your resources, and request/response bodies are defined using JSON Schema. There are tools which are able to generate documentation from a RAML description, but the use of this abstract definition of your API is not limited to documentation (other tools support fake server generation, etc)