message: Add ability to load facebook user profile
diff: @@ -668,7 +668,62 @@ function Facebookbot(configuration) {
  }
  };
  + var user_profile = function(uid, cb) {
  + return new Promise(function(resolve, reject) {
  + var uri = 'https://' + api_host + '/v2.6/' + uid + '&access_token=' + configuration.access_token;
  + request.post(uri, {},
  + function(err, res, body) {
  + if (err) {
  + facebook_botkit.log('Could not get user profile:', err);
  + if (cb) {
  + cb(err);
  + } else {
  + reject(err);
  + }
  + return;
  + } else {
  +
  + var results = null;
  + try {
  + results = JSON.parse(body);
  + } catch (err) {
  + facebook_botkit.log('ERROR in user profile call: Could not parse JSON', err, body);
  + if (cb) {
  + cb(err);
  + } else {
  + reject(err);
  + }
  + return;
  + }
  +
  + if (results) {
  + if (results.error) {
  + facebook_botkit.log('ERROR in user profile API call: ', results.error.message);
  + if (cb) {
  + cb(results.error);
  + } else {
  + reject(results.error);
  + }
  + } else {
  + if (cb) {
  + cb(null, results);
  + } else {
  + resolve(results);
  + }
  + }
  + }
  + }
  + });
  + });
  + };
  +
  +
  +
  +
  +
  +
  facebook_botkit.api = {
  + 'user_profile': user_profile,
  'messenger_profile': messenger_profile_api,
  'thread_settings': messenger_profile_api,
  'attachment_upload': attachment_upload_api,
  @@ -676,6 +731,10 @@ function Facebookbot(configuration) {
  'tags': tags,
  };
  +
  +
  +
  +
  // Verifies the SHA1 signature of the raw request payload before bodyParser parses it
  // Will abort parsing if signature is invalid, and pass a generic error to response
  function verifyRequest(req, res, buf, encoding) {
  