app.js
/*
 * Postback Event
 *
 * This event is called when a postback is tapped on a Structured Message. 
 * https://developers.facebook.com/docs/messenger-platform/webhook-reference/postback-received
 * 
 */
Postback Event
This event is called when a postback is tapped on a Structured Message.
Postback Event This event is called when a postback is tapped on a Structured Message .
function receivedPostback(event) {
	var senderID = event.sender.id;
	var recipientID = event.recipient.id;
	var timeOfPostback = event.timestamp;
	var payload = event.postback.payload;
	switch (payload) {
		case 'GET_STARTED':
			greetUserText(senderID);
			break;
		case 'JOB_APPLY':
			sendToApiAi(senderID, "job openings");
			break;
		case 'CHAT':
			sendTextMessage(senderID, "I love chatting too. Do you have any other questions for me?");
			break;
		default:
			sendTextMessage(senderID, "I'm not sure what you want. Can you be more specific?");
			break;
	}
	console.log("payload" + payload);
	console.log("Received postback for user %d and page %d with payload '%s' " +
		"at %d", senderID, recipientID, payload, timeOfPostback);
}
function receivedPostback ( event ) { var senderID = event . sender . id ; var recipientID = event . recipient . id ; var timeOfPostback = event . timestamp ; var payload = event . postback . payload ; switch ( payload ) { case 'GET_STARTED' : greetUserText ( senderID ) ; break ; case 'JOB_APPLY' : sendToApiAi ( senderID , "job openings" ) ; break ; case 'CHAT' : sendTextMessage ( senderID , "I love chatting too. Do you have any other questions for me?" ) ; break ; default : sendTextMessage ( senderID , "I'm not sure what you want. Can you be more specific?" ) ; break ; } console . log ( "payload" + payload ) ; console . log ( "Received postback for user %d and page %d with payload '%s' " + "at %d" , senderID , recipientID , payload , timeOfPostback ) ; }
Postback Event
 This event is called when a postback is tapped on a Structured Message.
Postback Event This event is called when a postback is tapped on a Structured Message .
// The 'payload' param is a developer-defined field which is set in a postback  // button for Structured Messages.  //get feedback with new jobs //user wants to chat //unindentified payload