in server-examples/nodejs-bot/bot.js [95:128]
function sendMessage (player, context, message, cta, payload) {
var button = {
type: 'game_play',
title: cta
};
if (context) {
button.context = context;
}
if (payload) {
button.payload = JSON.stringify(payload);
}
var messageData = {
recipient: {
id: player
},
message: {
attachment: {
type: 'template',
payload: {
template_type: 'generic',
elements: [
{
title: message,
buttons: [button]
}
]
}
}
}
};
callSendAPI(messageData);
}