in SampleIntegrations/SampleBots/NodeJS/EmployeeSurvey/app.js [192:222]
function sendStartSurvey(recipientId) {
request({
baseUrl: GRAPH_API_BASE,
url: '/' + recipientId,
qs: {
'fields': 'first_name'
},
auth: {'bearer' : ACCESS_TOKEN}
},function(error,response,body){
body = JSON.parse(body);
var messageData = {
recipient: {
id: body.id
},
message: {
text: `Hi ${body.first_name}, your opinion matters to us. Do you have a few seconds to answer a quick survey?`,
quick_replies: [{
content_type: 'text',
title: 'Yes',
payload: 'START_SURVEY'
},{
content_type: 'text',
title: 'Not now',
payload: 'DELAY_SURVEY'
}]
}
};
callSendAPI(messageData);
});
}