I have an entity "employeeType" in Dialogflow with values as "Federal employee" and "Private Employee".
If the entity data is not obtained, I want to ask user a question "Are you a Federal Employee?" to which user can respond "yes" or "no".
However I am not finding a way to do it since such a question wont return the predefined values "Federal employee" or "Private Employee".
Any thoughts on ways to fix this?
Here is my recommended approach:
employeeType entity but do not
mark it as requiredwebhook for this intent, and do not put any
fulfillment textemployeeType if it contains value
or its emptyemployeeType have value, just return a fulfillment text and
proceed with your flowemployeeType is empty, then set output context emp-followup
and put fulfillment text "Are you a Federal Employee?"emp-followup and put fulfillment text in
those to proceed with your flow

Sample Code:
req = request.get_json()
params = req.get('queryResult').get('parameters')
if params['employeeType']:
res = json.dumps({
"fulfillmentText": "great! welcome sir."
})
else:
res = json.dumps({
"outputContexts": [
{
"name": "{}/contexts/emp-followup".format(req['session']),
"lifespanCount": 2,
},
],
"fulfillmentText": "are you a federal employee"
})
return res
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With