message: trollface: Add pass_thread_control
diff: @@ -812,13 +812,46 @@ function Facebookbot(configuration) {
  if (results.error) {
  facebook_botkit.log('ERROR in take thread control API call: ', results.error.message);
  } else {
  - facebook_botkit.debug('Successfully take thread control', body);
  + facebook_botkit.debug('Successfully taken thread control', body);
  cb(result);
  }
  }
  }
  });
  + },
  + pass_thread_control: function(recipient, target, metadata, cb) {
  + var request_body = {
  + recipient: {
  + id: recipient
  + },
  + target_app_id: target,
  + metadata: metadata
  + };
  + request.post('https://' + api_host + '/v2.6/me/pass_thread_control?access_token=' + configuration.access_token,
  + request_body,
  + function(err, res, body) {
  + if (err) {
  + facebook_botkit.log('Could not pass thread control');
  + } else {
  +
  + var results = null;
  + try {
  + results = JSON.parse(body);
  + } catch (err) {
  + facebook_botkit.log('ERROR in pass thread control API call: Could not parse JSON', err, body);
  }
  +
  + if (results) {
  + if (results.error) {
  + facebook_botkit.log('ERROR in pass thread control API call: ', results.error.message);
  + } else {
  + facebook_botkit.debug('Successfully pass thread control', body);
  + cb(result);
  + }
  + }
  + }
  + });
  + },
  };
  facebook_botkit.api = {
  