Thanks for API.ai tutorial. I went ahead and followed API.ai tutorial created a weather widget in API.ai console that fetches weather information from weather api via webhook. Also it returns static responses if user query(what user ask) is incomplete .
The FLOWXO tutorial suggest to use a catch all trigger in the Api.ai tutorial.
Problems faced are below.
1.) I have configured HTTPS webhook to hit API.ai and set the request RAW data as below. Ideally what ever I enter should be the value for “query” key in the request JSON as below.
{
“query”: [
“{{catchall.message}}”
],
“contexts”: [{
“name”: “location”,
“lifespan”: 4
}],
“lang”: “en”,
“sessionId”: “{{catchall.user_id}}”
}
But when I checked interaction logs, query parameter gets populated with “start” due to which I get a static response from API.ai agent even before the user have entered any text in the chat bot. Below is the request that goes to API.ai.
{
“query”: [
“start”
],
“contexts”: [{
“name”: “location”,
“lifespan”: 4
}],
“lang”: “en”,
“sessionId”: “ok2r3a”
}
2.) The response from API.ai is of two types static and dynamic(fetched from webhook that retires data from weather api) for both response type, json format is different.
for static response - RESPONSE JSON has result field that contains speech key whoose value should be displayed data__result__speech
for dynamic response - RESPONSE JSON has fulfillment field that contains speech key whoose value should be displayed.
data__fulfillment__speech
How can I set a output message in Send a Message flow action considering the fact that response JSON format is changing depending upon user input.
Thanks,
Janmajay