docs: function receivedMessage(event) {
  
      var senderID = event.sender.id;
      var recipientID = event.recipient.id;
      var timeOfMessage = event.timestamp;
      var message = event.message;
  
      console.log("Received message for user %d and page %d at %d with message:",
          senderID, recipientID, timeOfMessage);
  
      var isEcho = message.is_echo;
      var messageId = message.mid;
      var appId = message.app_id;
      var metadata = message.metadata;
  
      // You may get a text or attachment but not both
      var messageText = message.text;
      var messageAttachments = message.attachments;
      var quickReply = message.quick_reply;
  
      if (isEcho) {
          // Just logging message echoes to console
          console.log("Received echo for message %s and app %d with metadata %s",
              messageId, appId, metadata);
        
          //See: https://developers.facebook.com/docs/messenger-platform/handover-protocol#app_roles
          //This app should be the Primary Receiver. Janis should be a Secondary Receiver.
          //Every time an echo from either Janis or the Page Inbox is received,
          //this app passes control over to Janis so the humans are the only ones who can respond.
          //Janis will pass control back to this app again after 10 minutes of inactivity. 
          //If you want to manually pass back control, use the slash command `/resume` 
          //in the Janis transcript channel, or press "Done" in the Page Inbox on the thread.
          janis.passThreadControl(event);
        
  
          return;
  
      } else if (quickReply) {
          var quickReplyPayload = quickReply.payload;
          console.log("Quick reply for message %s with payload %s",
              messageId, quickReplyPayload);
          
          //Let's convert the quick-reply payload into text so we can process it as user input
          if (APIAI_TOKEN &&
              (typeof quickReplyPayload === 'string' || quickReplyPayload instanceof String)) {
              //process quick reply payload as user input text with api.ai
              messageText = quickReplyPayload;
          } else {
              sendTextMessage(senderID, "Quick reply tapped");
              return;
          }
      }
      
      if (messageText) {
          if (APIAI_TOKEN) {
              //An example showing how to process user input if you're using API.AI
              receiveMessageWithApiai(messageText, senderID, event);
          } else {
              //An example showing how to process user input if you're not using API.AI
              receivedMessageWithoutNLP(messageText, senderID, event);
          }
      }
  }