function receivedMessage(msg) {
  let senderID = msg.sender.id
  let recipientID = msg.recipient.id
  let timeOfMessage = msg.timestamp
  let message = msg.message

  console.log('Received message "%s" for user %d and recipient %d of time %d', message.text, senderID, recipientID, timeOfMessage)
  // console.log(JSON.stringify(message))

  // Send typing icon to sender
  sendTypingMessage(senderID)

  // Delay few seconds then process the message
  setTimeout(function() {
    handleMessageWithStateManagement(senderID, recipientID, message)
  }, 2000)
}
/**
 * Called from handleHttpPost() to process a single message when webhook receives.
 * @param {object} msg Message object pass by Messenger
 */
Called from handleHttpPost() to process a single message when webhook receives.
@param {object} msg Message object pass by Messenger
Called from handleHttpPost () to process a single message when webhook receives . @param { object } msg Message object pass by Messenger
function receivedMessage(msg) {
  let senderID = msg.sender.id
  let recipientID = msg.recipient.id
  let timeOfMessage = msg.timestamp
  let message = msg.message
  console.log('Received message "%s" for user %d and recipient %d of time %d', message.text, senderID, recipientID, timeOfMessage)
  sendTypingMessage(senderID)
  setTimeout(function() {
    handleMessageWithStateManagement(senderID, recipientID, message)
  }, 2000)
}
function receivedMessage ( msg ) { let senderID = msg . sender . id let recipientID = msg . recipient . id let timeOfMessage = msg . timestamp let message = msg . message console . log ( 'Received message "%s" for user %d and recipient %d of time %d' , message . text , senderID , recipientID , timeOfMessage ) sendTypingMessage ( senderID ) setTimeout ( function ( ) { handleMessageWithStateManagement ( senderID , recipientID , message ) } , 2000 ) }
Called from handleHttpPost() to process a single message when webhook receives.
Called from handleHttpPost () to process a single message when webhook receives .
// console.log(JSON.stringify(message)) // Send typing icon to sender // Delay few seconds then process the message