Structure for Arrow Chat Bot

Buttons Template

var buttonTemplate = [{
type: "postback",
title: "Jan Dhan Yojana",
payload: {
variable: "global_policy_name",
value: "jandhanyojna"
},
variableType: {
type: 'values',
valueName: 'global_policy_name_jandhan' // create from entity tab
}
}, {
type: "postback",
title: "Pradhan Mantri Mudra Yojana",
payload: {
variable: "global_policy_name",
value: "mudra"
},
variableType: {
type: 'values',
valueName: 'global_policy_name_mudra'
}

}, {
type: "postback",
title: "Go to schemes & news section",
payload: {
variable: "global_policy_name",
value: "back"
},
variableType: {
type: 'values',
valueName: 'global_policy_name_back'
}

}];
exit(views.buttons(buttonTemplate, "For details, select one of the following"));

Card Template

var searchCardTemplate = [];
var data = variable.recommendation_data_for_drink_selected;
newVariable.suggested_cocktail = data;
_.each(data, function(d, index) {
if (d != null) {
var alternate = d.cocktailName.split(' ');
alternate.push(d.cocktailName);
searchCardTemplate.push({
type: 'card_list',
id: index,
title: d.cocktailName,
image: _.escape(d.cocktailImage).trim(),
description: _.escape(d.categoryDescription).trim(),
buttons: [{
type: "postback",
title: 'Choose',
payload: {
variable: "global_cocktail_selected_for_info",
value: d.cocktailName
},
variableType: {
type: 'regexParser',
valueName: 'global_cocktail_selected_for_info_' + d.cocktailName.split(' ').join('_'),
values: alternate
}
}, {
type: "postback",
title: 'No Thanks',
payload: {
variable: "global_cocktail_selected_for_info",
value: 'no'
},
variableType: {
type: 'regexParser',
valueName: 'global_cocktail_selected_for_info_no',
values: ['no', 'no thanks', 'not', 'did not']
}
}]
});
}

Like what you read? Give Gaurav Singh a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.