function sendGenericMessage(recipientId) {
  let messageData = {
    recipient: {
      id: recipientId
    },
    message: {
      attachment: {
        type: "template",
        payload: {
          template_type: "generic",
          elements: [{
            title: "rift",
            subtitle: "Next-generation virtual reality",
            item_url: "https://www.oculus.com/en-us/rift/",               
            image_url: "http://messengerdemo.parseapp.com/img/rift.png",
            buttons: [{
              type: "web_url",
              url: "https://www.oculus.com/en-us/rift/",
              title: "Open Web URL"
            }, {
              type: "postback",
              title: "Call Postback",
              payload: "Payload for first bubble",
            }],
          }, {
            title: "touch",
            subtitle: "Your Hands, Now in VR",
            item_url: "https://www.oculus.com/en-us/touch/",               
            image_url: "http://messengerdemo.parseapp.com/img/touch.png",
            buttons: [{
              type: "web_url",
              url: "https://www.oculus.com/en-us/touch/",
              title: "Open Web URL"
            }, {
              type: "postback",
              title: "Call Postback",
              payload: "Payload for second bubble",
            }]
          }]
        }
      }
    }
  }

  callSendAPI(messageData)
}
/**
 * Send a generic message to specify Messenger user.
 * @param {string} recipientId Messenger receipient ID to receive the message
 * Note: For info of Generic message: https://developers.facebook.com/docs/messenger-platform/send-api-reference/generic-template
 */
Send a generic message to specify Messenger user.
Send a generic message to specify Messenger user .
function sendGenericMessage(recipientId) {
  let messageData = {
    recipient: {
      id: recipientId
    },
    message: {
      attachment: {
        type: "template",
        payload: {
          template_type: "generic",
          elements: [{
            title: "rift",
            subtitle: "Next-generation virtual reality",
            item_url: "https://www.oculus.com/en-us/rift/",               
            image_url: "http://messengerdemo.parseapp.com/img/rift.png",
            buttons: [{
              type: "web_url",
              url: "https://www.oculus.com/en-us/rift/",
              title: "Open Web URL"
            }, {
              type: "postback",
              title: "Call Postback",
              payload: "Payload for first bubble",
            }],
          }, {
            title: "touch",
            subtitle: "Your Hands, Now in VR",
            item_url: "https://www.oculus.com/en-us/touch/",               
            image_url: "http://messengerdemo.parseapp.com/img/touch.png",
            buttons: [{
              type: "web_url",
              url: "https://www.oculus.com/en-us/touch/",
              title: "Open Web URL"
            }, {
              type: "postback",
              title: "Call Postback",
              payload: "Payload for second bubble",
            }]
          }]
        }
      }
    }
  }
  callSendAPI(messageData)
}
function sendGenericMessage ( recipientId ) { let messageData = { recipient : { id : recipientId } , message : { attachment : { type : "template" , payload : { template_type : "generic" , elements : [ { title : "rift" , subtitle : "Next-generation virtual reality" , item_url : "https://www.oculus.com/en-us/rift/" , image_url : "http://messengerdemo.parseapp.com/img/rift.png" , buttons : [ { type : "web_url" , url : "https://www.oculus.com/en-us/rift/" , title : "Open Web URL" } , { type : "postback" , title : "Call Postback" , payload : "Payload for first bubble" , } ] , } , { title : "touch" , subtitle : "Your Hands, Now in VR" , item_url : "https://www.oculus.com/en-us/touch/" , image_url : "http://messengerdemo.parseapp.com/img/touch.png" , buttons : [ { type : "web_url" , url : "https://www.oculus.com/en-us/touch/" , title : "Open Web URL" } , { type : "postback" , title : "Call Postback" , payload : "Payload for second bubble" , } ] } ] } } } } callSendAPI ( messageData ) }
Send a generic message to specify Messenger user.
Send a generic message to specify Messenger user .