I have created a Dynamic card in Dialogflow that should display in hangouts. Here is the custom card i have created in Dialogflow responses under custom payload:
{
"hangouts": {
"header": {
"imageUrl": "imageurl",
"title": "Hi, Select your choice ?"
},
"sections": [
{
"widgets": [
{
"buttons": [
{
"textButton": {
"text": "Card",
"onClick": {
"action": {
"actionMethodName": "CardResponder"
}
}
}
},
{
"textButton": {
"text": "Cash",
"onClick": {
"action": {
"actionMethodName": "CashResponder"
}
}
}
}
]
}
]
}
]
}
}
The card looks like this in hangouts. card
In the webhook code my entry point is this:
app.post('/', express.json(), (req,res)=>{
if(req.body.queryResult.intent.displayName == "PaymentIntent"){
........
}
});
I am not able to detect the event when i click on Cash or Card button on my hangouts dynamic card. I have defined function name as well in the actionMethodName parameter. But I am not sure how to write that function in my webhook code. Please help me.
Update
app.post('/', express.json(), (req,res)=>{
console.log(req.body);
console.log(req.body.action.actionMethodName);
});
I am trying to console req.body which gives me
originalDetectIntentRequest: { source: 'hangouts', payload: { data: [Object] } },
req.body.action.actionMethodName gives undefined.
When i try to click button in hangouts card it gives me this error - Unable to contact hangouts-bot. Try again later.
hangouts-bot is the name of my cloud project. I do not know how to recieve the click request in my node js code.