I need receive the messages created in response texts in some intentions of the API.AI - chatbot

My issue:
I have two responses, but my chat return only one specified "the speech", but i need that return the two, like do the console of api
example of response JSON from API:
{
"id": "XXXXXXXXXXX",
"timestamp": "2017-07-12T20:08:48.101Z",
"lang": "es",
"result": {
"source": "agent",
"resolvedQuery": "Hello how are you?",
"action": "",
"actionIncomplete": false,
"parameters": {},
"contexts": [
{
"name": "intent",
"parameters": {},
"lifespan": 1
}
],
"metadata": {
"intentId": "XXXXXXXXXXXXXXXXXXXXXXXX",
"webhookUsed": "false",
"webhookForSlotFillingUsed": "false",
"intentName": "welcome"
},
"fulfillment": {
"speech": "Hello!",
"messages": [
{
"type": 0,
"speech": "Hello!"
},
{
"type": 0,
"speech": "Bye!"
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": ""
}
I need show the black messages.

Related

Sabre BargainFinderMax REST API error for /offers/shop for southwest airlines (IATA code: WN)

We are trying to use BargainFinderMax REST API v3/offers/shop and /v4/offers/shop for southwest airlines (WN) but getting errors for the following requests in the CERT environment
We have tied both the old & new domain name endpoints (as per https://developer.sabre.com/guides/travel-agency/developer-guides/api-endpoints) but still throwing the error
New Endpoints:
https://api.cert.platform.sabre.com/v4/offers/shop
https://api.cert.platform.sabre.com/v3/offers/shop
Old Endpoints:
https://api-crt.cert.havail.sabre.com/v4/offers/shop
https://api-crt.cert.havail.sabre.com/v3/offers/shop
Request#1:
{
"OTA_AirLowFareSearchRQ": {
"MaxResponses": "10",
"OriginDestinationInformation": [{
"RPH": "1",
"DepartureDateTime": "2022-08-19T00:00:00",
"OriginLocation": {
"LocationCode": "SFO"
},
"DestinationLocation": {
"LocationCode": "LAX"
},
"TPA_Extensions": {
"SegmentType": {
"Code": "O"
}
}
}],
"POS": {
"Source": [{
"PseudoCityCode": "xxxx",
"RequestorID": {
"CompanyName": {
"Code": "TN"
},
"ID": "xxx.xx",
"Type": "x.xxx.x"
}
}]
},
"TravelPreferences": {
"MaxStopsQuantity": 99,
"TPA_Extensions": {
"DataSources": {
"ATPCO": "Enable",
"LCC": "Disable",
"NDC": "Disable"
},
"NumTrips": {
"Number": 10
}
},
"VendorPref": [{
"Code": "WN"
}]
},
"TravelerInfoSummary": {
"AirTravelerAvail": [{
"PassengerTypeQuantity": [{
"Code": "ADT",
"Quantity": 1
}]
}],
"PriceRequestInformation": {
"TPA_Extensions": {}
},
"SeatsRequested": [1]
},
"TPA_Extensions": {
"IntelliSellTransaction": {
"RequestType": {
"Name": "xxxITINS"
}
}
},
"Version": "3"
}
}
Request#2:
{
"OTA_AirLowFareSearchRQ": {
"MaxResponses": "10",
"OriginDestinationInformation": [{
"RPH": "1",
"DepartureDateTime": "2022-08-20T00:00:00",
"OriginLocation": {
"LocationCode": "SFO"
},
"DestinationLocation": {
"LocationCode": "LAX"
},
"TPA_Extensions": {
"SegmentType": {
"Code": "O"
}
}
}],
"POS": {
"Source": [{
"PseudoCityCode": "xxxx",
"RequestorID": {
"CompanyName": {
"Code": "TN"
},
"ID": "xx.xx",
"Type": "x.xxx.x"
}
}]
},
"TravelPreferences": {
"MaxStopsQuantity": 99,
"TPA_Extensions": {
"DataSources": {
"ATPCO": "Enable",
"LCC": "Disable",
"NDC": "Disable"
},
"NumTrips": {
"Number": 10
}
},
"VendorPref": [{
"Code": "WN"
}]
},
"TravelerInfoSummary": {
"AirTravelerAvail": [{
"PassengerTypeQuantity": [{
"Code": "ADT",
"Quantity": 1
}]
}],
"PriceRequestInformation": {
"TPA_Extensions": {}
},
"SeatsRequested": [1]
},
"TPA_Extensions": {
"IntelliSellTransaction": {
"RequestType": {
"Name": "xxxITINS"
}
}
},
"Version": "3"
}
}
Response#1:
{
"groupedItineraryResponse": {
"version": "6.6.1",
"messages": [{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSCIL672.ATSE.CERT.ASCINT.SABRECIRRUS.COM",
"text": "27040"
}, {
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "3620995504794847122"
}, {
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "13292"
}, {
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "25238"
}, {
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR QUALIFIERS USED"
}, {
"severity": "Error",
"type": "IF2",
"code": "PROCESS",
"text": "No complete journey can be built in IF2/ADVJR1."
}, {
"severity": "Error",
"type": "ERR",
"code": "ERR",
"text": "Error during Processing"
}],
"statistics": {
"itineraryCount": 0
}
}
}
Response#2:
{
"groupedItineraryResponse": {
"version": "6.3.0",
"messages": [{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSCIL744.ATSE.CERT.ASCINT.SABRECIRRUS.COM",
"text": "27035"
}, {
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "3623196258955057549"
}, {
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "13292"
}, {
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "25238"
}, {
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR QUALIFIERS USED"
}, {
"severity": "Error",
"type": "IF2",
"code": "PROCESS",
"text": "No complete journey can be built in IF2/ADVJR1."
}, {
"severity": "Error",
"type": "ERR",
"code": "ERR",
"text": "Error during Processing"
}],
"statistics": {
"itineraryCount": 0
}
}
}
Also, tested this using /v1/offers/shop/ in PROD environment using old endpoint and still see the same issue.
Endpoint: https://api.havail.sabre.com/v1/offers/shop,
{
"groupedItineraryResponse": {
"version": "5.2.0",
"messages": [{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSPIL9BE.IDM.SGDCPROD.SABRE.COM",
"text": "27041"
}, {
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "3629312323318444028"
}, {
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "15943"
}, {
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "17500"
}, {
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR QUALIFIERS USED"
}, {
"severity": "Error",
"type": "IF2",
"code": "PROCESS",
"text": "No complete journey can be built in IF2/ADVJR1."
}, {
"severity": "Error",
"type": "ERR",
"code": "ERR",
"text": "Error during Processing"
}],
"statistics": {
"itineraryCount": 0
}
}
}
Same API call is working fine for other airline codes like Delta Airlines ('DL'), American Airlines ('AA'), United Airlines ('UA'), etc.
Can anyone share any insight on why this is happening and how can we fix this behaviour ?
This error possibly means there’s no flights for this route on WN for this dates.
Try checking WN website and try different dates.
Here's the approach we followed to fix this
In order for us to get southwest airlines(WN) content, the PCC we use has to be whitelisted and southwest airlines(WN) does that by whitelisting using the actual ARC numbers. We have an active ARC number and requested that it be added to the PCC by Sabre as it's already been whitelisted by Southwest. Once Sabre made the changes, the WN content became available for PCC and we could see WN flights being listed when we hit Sabre BFM REST API v4.
FYI - https://developer.sabre.com/guides/travel-agency/concepts/glossary

Sending WhatsApp interactive message of list type fails when sent with image header

I am able to send interactive message with "button" type and 3 buttons with image header.
But sending interactive message with "list" type and same image header fails with error:
{
"meta": {
"api_status": "stable",
"version": "2.39.4"
},
"errors": [
{
"code": 1008,
"title": "Required parameter is missing",
"details": "Failed building interactive message. Invalid Header."
}
]
}
Is it possible that "list" interactive messages doesn't support "image" header without stating it in documentation?
Successful "button" interactive payload (image URL changed):
{
"to": "972000000000",
"type": "interactive",
"interactive": {
"body": {
"text": "Select a branch for the takeaway by writing the name/number"
},
"action": {
"buttons": [
{
"reply": {
"id": "MQ==",
"title": "1"
},
"type": "reply"
},
{
"reply": {
"id": "Mg==",
"title": "2"
},
"type": "reply"
}
]
},
"type": "button",
"header": {
"image": {
"link": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png"
},
"type": "image"
}
}
}
Successful "button" interactive message result:
Failed "list" interactive payload (image URL changed):
{
"to": "972000000000",
"type": "interactive",
"interactive": {
"body": {
"text": "Select a branch for the takeaway by writing the name/number"
},
"action": {
"button": "Options",
"sections": [
{
"rows": [
{
"id": "MQ==",
"title": "1"
},
{
"id": "Mg==",
"title": "2"
},
{
"id": "Mw==",
"title": "3"
},
{
"id": "NA==",
"title": "4"
},
{
"id": "NQ==",
"title": "5"
},
{
"id": "Ng==",
"title": "6"
},
{
"id": "Nw==",
"title": "7"
},
{
"id": "OA==",
"title": "8"
},
{
"id": "OQ==",
"title": "9"
},
{
"id": "MTA=",
"title": "10"
}
]
}
]
},
"type": "list",
"header": {
"image": {
"link": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png"
},
"type": "image"
}
}
}
Well, it does state it in the docs. I'm just blind:
Kinda weird though "image" header not supported for "list".

DialogFlow: Missing "user" property in JSON after successful Google Account linking

So after successful Google Account linking in my app, I tested it using an Android device without any problem. I used the "in conversation prompt" technique to request the user to authenticate to proceed further. In other words, I was successfully able to receive the "user" property of response from Dialogflow with valid accessToken (among other info).
Now, I tried it on a Google Home device. The device is configured with the same email Id I used on the Android mobile device. The G.Home successfully loads the app when I invoke it. But the missing part here is the accessToken in the user property (JSON below). I have assumed the following in the above scenario:
Since I have already signed in successfully on the Android mobile device, the next time I try to invoke the app on the same device, the app doesn't prompts for the "sign in" because it already has the accessToken (until it is expired). And since I am using the same gmail address on the G. Home device, I should have gotten the same accessToken as well.
As long as the same gmail address is used, it doesn't matter what device/surface I use to Google auth myself, I will always get the accessToken if it has not expired.
The setup/configuration for the whole Google Account linking is detailed in the above link I've shared. Here is the JSON I've received on G. Home and Android device respectively:
{
"originalRequest": {
"source": "google",
"version": "2",
"data": {
"isInSandbox": true,
"surface": {
"capabilities": [
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
},
"inputs": [
{
"rawInputs": [
{
"query": "continue",
"inputType": "VOICE"
}
],
"arguments": [
{
"rawText": "continue",
"textValue": "continue",
"name": "text"
}
],
"intent": "actions.intent.TEXT"
}
],
"user": {
"lastSeen": "2018-07-17T10:33:57Z",
"locale": "en-US",
"userId": "15229245xxx"
},
"conversation": {
"conversationId": "153182806xxx",
"type": "ACTIVE",
"conversationToken": "[\"disclaimer_option\"]"
},
"availableSurfaces": [
{
"capabilities": [
{
"name": "actions.capability.SCREEN_OUTPUT"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.WEB_BROWSER"
}
]
}
]
}
},
"id": "9459d297-4746-4ffe-99fa-xxx",
"timestamp": "2018-07-17T11:49:02.693Z",
"lang": "en-us",
"result": {
"source": "agent",
"resolvedQuery": "continue",
"speech": "",
"action": "v00.authentication.pin",
"actionIncomplete": false,
"parameters": {
"CallEnum": "Login"
},
"contexts": [
{
"name": "disclaimer_option",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "pin",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 1
},
{
"name": "google_assistant_input_type_voice",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "actions_capability_audio_output",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "actions_capability_media_response_audio",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
}
],
"metadata": {
"intentName": "v00.authentication.pin",
"isResponseToSlotfilling": false,
"intentId": "146f0d7d-0194-43cb-90e4-xxx",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"nluResponseTime": 87
},
"fulfillment": {
"speech": "",
"messages": []
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "15318280xxx"
}
and
{
"originalRequest": {
"source": "google",
"version": "2",
"data": {
"isInSandbox": true,
"surface": {
"capabilities": [
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.WEB_BROWSER"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
}
]
},
"inputs": [
{
"rawInputs": [
{
"query": "Continue",
"inputType": "TOUCH"
}
],
"arguments": [
{
"rawText": "Continue",
"textValue": "Continue",
"name": "text"
}
],
"intent": "actions.intent.TEXT"
}
],
"user": {
"lastSeen": "2018-07-17T09:44:08Z",
"accessToken": "6IlPNz0YFb_stP0quM1xxx",
"locale": "en-US",
"userId": "15229245xxx"
},
"conversation": {
"conversationId": "153182082xxx",
"type": "ACTIVE",
"conversationToken": "[\"disclaimer_option\"]"
},
"availableSurfaces": [
{
"capabilities": [
{
"name": "actions.capability.WEB_BROWSER"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
}
]
}
]
}
},
"id": "ae2e3ff8-f351-497b-9429-xxx",
"timestamp": "2018-07-17T09:47:54.999Z",
"lang": "en-us",
"result": {
"source": "agent",
"resolvedQuery": "Continue",
"speech": "",
"action": "v00.authentication.pin",
"actionIncomplete": false,
"parameters": {
"CallEnum": "Login"
},
"contexts": [
{
"name": "google_assistant_input_type_touch",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "pin",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 1
},
{
"name": "disclaimer_option",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "actions_capability_screen_output",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "actions_capability_audio_output",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "actions_capability_media_response_audio",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
},
{
"name": "actions_capability_web_browser",
"parameters": {
"CallEnum": "Login",
"CallEnum.original": ""
},
"lifespan": 0
}
],
"metadata": {
"intentName": "v00.authentication.pin",
"isResponseToSlotfilling": false,
"intentId": "146f0d7d-0194-43cb-90e4-xxx",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"nluResponseTime": 87
},
"fulfillment": {
"speech": "",
"messages": []
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "153182082xxx"
}
My question is, where can I get the accessToken when I am using the Google Home device?

Gupshup consume post to create Embedding form

im working with Gupshup and I want to add subview in my chat.
To make this I create this vars:
var url="https://api.gupshup.io/sm/api/facebook/smartmsg/form/create";
var header = {"apikey":"xxxxxxxxxxxxxxxxxxx","Content-Type": "application/x-www-form-urlencoded","Accept":"application/json"};
var param={"formJSON":{
"title": "This is a test.",
"autoClose": false,
"message": "Thank You",
"callback-url": "https://www.gupshup.io/developer/bot/Cotizador/public",
"fields": [{
"type": "fbid",
"name": "fbname",
"label": "fbName"
}, {
"type": "input",
"name": "name",
"label": "Name",
"validations": [{
"regex": "^[A-Z a-z]+$",
"msg": "Only alphabets are allowed in this field"
}, {
"regex": "^[A-Z a-z]{6,}$",
"msg": "Minimum 6 characters required"
}]
}, {
"type": "radio",
"name": "gender",
"label": "Gender",
"options": [
"Male",
"Female"
],
"validations": [{
"regex": "",
"msg": ""
}]
}, {
"type": "select",
"name": "account",
"label": "AccountType",
"options": [
"current",
"savings"
],
"validations": [{
"regex": "",
"msg": ""
}]
}, {
"type": "checkbox",
"name": "interest",
"label": "Interests",
"options": [
"Cooking",
"Reading"
],
"validations": [{
"regex": "",
"msg": ""
}]
}],
"users": [
"Testing"
]
}}
And call post with:
context.simplehttp.makePost(url,JSON.stringify(param),header,parser);
And my call back
function parser(context, event) {
context.console.log("Handler https")
var result= JSON.parse(event.getresp);
if(result=="success"){
context.sendResponse("We have successfully stored your data");
}else{
context.sendResponse("We dont shoot");
}
}
But when, make the request post, but don't show me response in chat or in callback. What im doing wrong?
Sohan from Gupshup here.
The result from the API that you are using is this:
[{
"embedlink": "https://api.gupshup.io/sm/api/facebook/smartmsg/embed/66438dde-ec76-4d6e-a0d0-8cfc0c730e57",
"expired": false,
"fb-button": {
"title": "This is a test.",
"type": "web_url",
"url": "https://api.gupshup.io/sm/api/facebook/smartmsg/embed/66438dde-ec76-4d6e-a0d0-8cfc0c730e57",
"webview_height_ratio": "tall"
},
"id": "66438dde-ec76-4d6e-a0d0-8cfc0c730e57",
"signed-for": {
"display": "Testing",
"subdisplay": "Testing"
},
"smid": "1009"
}]
Thus when you do:
var result= JSON.parse(event.getresp);
if(result=="success"){
context.sendResponse(result) will display the entire JSON that you see above. To display the 'expired' field you can use result.expired.
Check this document for more information.

What rest API can be used to get default values of fields for create issue?

I am using jira rest api's in my application.
I have found the api for getting the meta-data for creating jira issue but that API doesn't return default values of the fields for example :-
This is the request :-
http://kelpie9:8081/rest/api/latest/issue/createmeta?projectKeys=QA&issuetypeNames=Bug&expand=project.issuetypes.fields
the default value of priority field is set to "major" and the description of priority is also customized but the return from api is:-
{
"expand": "projects",
"projects": [
{
"expand": "issuetypes",
"self": "http://kelpie9:8081/rest/api/2/project/QA",
"id": "10010",
"key": "QA",
"name": "QA",
"avatarUrls": {
"16x16": "http://kelpie9:8081/secure/projectavatar?size=small&pid=10010&avatarId=10011",
"48x48": "http://kelpie9:8081/secure/projectavatar?pid=10010&avatarId=10011"
},
"issuetypes": [
{
"expand": "fields",
"self": "http://kelpie9:8081/rest/api/2/issuetype/1",
"id": 1,
"name": "Bug",
"iconUrl": "http://kelpie9:8081/images/icons/bug.gif",
"fields": {
"summary": {
"required": true,
"schema": {
"type": "string",
"system": "summary"
},
"operations": [
"set"
]
},
"timetracking": {
"required": false,
"operations": [ ]
},
"issuetype": {
"required": true,
"schema": {
"type": "issuetype",
"system": "issuetype"
},
"operations": [ ],
"allowedValues": [
{
"id": "1",
"name": "Bug",
"description": "A problem which impairs or prevents the functions of the product.",
"iconUrl": "http://kelpie9:8081/images/icons/bug.gif"
}
]
},
"priority": {
"required": false,
"schema": {
"type": "priority",
"system": "priority"
},
"name": "Priority",
"operations": [
"set"
],
"allowedValues": [
{
"self": "http://172.19.30.101:18080/rest/api/2/priority/1",
"iconUrl": "http://172.19.30.101:18080/images/icons/priority_blocker.gif",
"name": "Blocker",
"id": "1"
},
{
"self": "http://172.19.30.101:18080/rest/api/2/priority/2",
"iconUrl": "http://172.19.30.101:18080/images/icons/priority_critical.gif",
"name": "Critical",
"id": "2"
},
{
"self": "http://172.19.30.101:18080/rest/api/2/priority/3",
"iconUrl": "http://172.19.30.101:18080/images/icons/priority_major.gif",
"name": "Major",
"id": "3"
},
{
"self": "http://172.19.30.101:18080/rest/api/2/priority/4",
"iconUrl": "http://172.19.30.101:18080/images/icons/priority_minor.gif",
"name": "Minor",
"id": "4"
},
{
"self": "http://172.19.30.101:18080/rest/api/2/priority/5",
"iconUrl": "http://172.19.30.101:18080/images/icons/priority_trivial.gif",
"name": "Trivial",
"id": "5"
}
]
},
"customfield_10080": {
"required": false,
"schema": {
"type": "array",
"items": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:labels",
"customId": 10080
},
"operations": [ ]
},
"customfield_10010": {
"required": false,
"schema": {
"type": "array",
"items": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:labels",
"customId": 10010
},
"operations": [ ]
},
"customfield_10071": {
"required": false,
"schema": {
"type": "array",
"items": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
"customId": 10071
},
"operations": [ ]
}
}
}
]
}
]
}
There is nothing like default value or description in priority field, how will I get those values?