node.js - HTTP / HTTPS GET Request Alexa Skill - "The Response is Invalid" Lambda Response -
i building alexa skill tells user closest kaiser permanente hospital, clinic, or pharmacy. when test using 1 of 3 keywords, error: the response invalid.
giving invalid (using none of 3 keywords) response gives me error: the remote endpoint not called, or response returned invalid.
i @ loss how figure out or issue is, not given details issue.
function getwelcomeresponse(callback) { var speechoutput = "welcome kaiser permanente alexa skill. allow me find nearest kaiser hospital, pharmacy, or clinic."; var reprompt = "would me find nearest kaiser hospital, pharmacy, or clinic?"; var header = "kaiser permanente skill"; var shouldendsession = false; var sessionattributes = { "speechoutput" : speechoutput, "reprompttext" : reprompt, }; callback(sessionattributes, buildspeechletresponse(header, speechoutput, reprompt, shouldendsession)); } function handlegetkaiserbuildingintent(intent, session, callback) { var buildingtype = intent.slots.building.value.tolowercase(); var speechoutput = "we have error fam."; if (buildingtype != bldg_type.pharmacy || buildingtype != bldg_type.clinic || buildingtype != bldg_type.hospital) { speechoutput = "please try again. can find nearest kaiser hospital, clinic, or pharmacy."; var reprompttext = "please try again. can find nearest kaiser hospital, clinic, or pharmacy."; var header = "error fam."; } else { getjson(function(data) { if (data != "error") { speechoutput = data; } callback(session.attributes, buildspeechletresponsewithoutcard(speechoutput, "", true)); }, buildingtype); } } function getjson(callback, building) { request.get(url(building), function(error, response, body) { var d = json.parse(body); var result = d.list[0].contents.title; if (result != null) { callback(result); } else { callback("error"); } }); } function url(building) { switch (building) { case bldg_type.hospital: return "http://xjzxdss0040x.dta.kp.org/search/cgi-bin/query-meta?v%3aproject=kp-mg-facdir-project&v:sources=kp-mg-facdir-proximity&query=hospital&user_lat=37.928243&user_lon=-121.9700594&render.function=json-feed-display-brief&content-type=application-json"; break; case bldg_type.pharmacy: return "http://xjzxdss0040x.dta.kp.org/search/cgi-bin/query-meta?v%3aproject=kp-mg-facdir-project&v:sources=kp-mg-facdir-proximity&query=pharmacy&user_lat=37.928243&user_lon=-121.9700594&render.function=json-feed-display-brief&content-type=application-json"; break; case bldg_type.clinic: return "http://xjzxdss0040x.dta.kp.org/search/cgi-bin/query-meta?v%3aproject=kp-mg-facdir-project&v:sources=kp-mg-facdir-proximity&query=clinic&user_lat=37.928243&user_lon=-121.9700594&render.function=json-feed-display-brief&content-type=application-json"; break; default: break; } }
it's difficult problems you've given. improperly uploaded lambda function or json response big , hitting response size limit. best start trouble shooting problem @ error logs in cloudwatch , see says.
Comments
Post a Comment