I have created a chatbot in DialogFlow CX. After a customer identifies themselves, a call is made to the webhook (written in Python) which finds the 3 closest retail stores to the customer, and returns those in the webhook response as parameters:
bot_response = {
"fulfillment_response":
{
"messages": [
{
"text": {
"text": [
f'Thanks {first_name}! I\'ve located your account.'
]
}
}
]
},
"session_info": {
"session": session_name,
"parameters": {
"first_name": first_name,
"email_address": email_address,
"business_partner_id": business_partner_id,
"address_line_1": c['response']['address_line_1'],
"address_line_2": c['response']['address_line_2'],
"suburb": c['response']['suburb'],
"postcode": c['response']['postcode'],
"region": c['response']['state'],
"store_1": locations[0].store_name,
"store_1_id": locations[0].store_id,
"store_1_address": locations[0].address,
"store_2": locations[1].store_name,
"store_2_id": locations[1].store_id,
"store_2_address": locations[1].address,
"store_3": locations[2].store_name,
"store_3_id": locations[2].store_id,
"store_3_address": locations[2].address
}
}
}
My intention is to allow the customer to select 1 of these 3 store locations. In the above model, I've returned them as parameters, which are successfully recorded in dialogflow, however I am stuck on how to provide these values as a list of options to the customer. I am unsure whether I can
a) Provide a list of options back to the user as a Webhook Response (instead of parameters). All documentation I can find suggests only that text and parameters can be returned.
Or
b) Use the returned parameters to create a custom payload to present them as a list for the user to select from. Something like:
{
"richContent": [
[
{
"event": {
"name": "Store1",
"parameters": {},
"languageCode": ""
},
"subtitle": "${store_1_id}",
"title": "${store_1_address}",
"type": "list"
}
]
]
}
But I cannot find any documentation to suggest you can embed parameters into custom payloads.
Does anyone know of a way to solve this situation? Thank you!