{"size": 671, "ext": "js", "max_stars_repo_path": "lib/setupGreetingText.js", "max_stars_repo_name": "Clevyio/workplace-safety-check", "max_stars_repo_stars_event_min_datetime": "2017-04-29T15:48:50.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-12T17:39:48.000Z", "max_issues_repo_path": "lib/setupGreetingText.js", "max_issues_repo_name": "BorisHenne/safetybot-github", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/setupGreetingText.js", "max_forks_repo_name": "BorisHenne/safetybot-github", "max_forks_repo_forks_event_min_datetime": "2017-05-13T21:40:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-12T17:39:49.000Z"}
{"max_stars_count": 6, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 25.8076923077, "max_line_length": 73, "alphanum_fraction": 0.60804769}
'use strict';
let Promise = require("bluebird");
let request = require("superagent");
request = require("superagent-promise")(request, Promise);

/**
 * Setup the welcome message
 */
module.exports = () => {
  return request.post(process.env.GRAPH_API_BASE + '/me/thread_settings')
    .query({ access_token: process.env.APP_ACCESS_TOKEN })
    .send({
      "setting_type": "greeting",
      "greeting": {
        "text": process.env.SC_IDLE_INFO_MSG
      }
    })
    .then((res) => {
      console.log(res.text);
      return JSON.parse(res.text);
    })
    .catch((err) => {
      console.log("error setting the greeting text: ", err);
      return null;
    });
};