code: function generateMessage(type, data)
  {
    var message;
  
    switch (type)
    {
      // default message type, no need to perform special actions, will be sent as is
      case types.MESSAGE:
        message = data;
        break;
  
      case types.TEXT:
        // `text` must be UTF-8 and has a 320 character limit
        // https://developers.facebook.com/docs/messenger-platform/send-api-reference/text-message
        message = {text: data.substr(0, 320)};
        break;
  
      case types.AUDIO:
      case types.FILE:
      case types.IMAGE:
      case types.VIDEO:
        message = {attachment: {type: type, payload: {url: data}}};
        break;
  
      case types.QUICK_REPLIES:
        // `quick_replies` is limited to 10
        // https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies
        message = {text: data.text, quick_replies: data.quick_replies.slice(0, 10)};
        break;
  
      case types.GENERIC:
        message = templates.generic.call(this, data);
        break;
  
      case types.BUTTON:
        message = templates.button.call(this, data);
        break;
  
      case types.RECEIPT:
        message = templates.receipt.call(this, data);
        break;
  
      default:
        this.logger.error({message: 'Unrecognized message type', type: type, payload: data});
    }
  
    return message;
  }
docs: Generates message from the provided data object
  with respect for the message type
  
  @private
  @this    Fbbot#
  @param   {string} type - message type
  @param   {object} data - message data object
  @returns {object} - generated message object