// holds users //public void GetUsers() //{ // try // { // string url = @" https://slack.com/api/users.list"; // //string = string.Format("{0}?token={1}&pretty=1", url, ConfigurationManager.Token); // Dictionary<string, string> parameters = new Dictionary<string, string>() // { // { "token", "ConfigurationManager.Token" }, // { "pretty", "1" }, // }; // var response = HTTPManager.GetRequest(url, ContentType, parameters); // } // catch (Exception exception) // { // } //} public UserResponse GetUser(string userId) { UserResponse userResponse = null; try { if (string.IsNullOrEmpty(userId)) { return(userResponse); } string url = @"https://slack.com/api/users.info"; //string = string.Format("{0}?token={1}&user={2}&pretty=1", url, ConfigurationManager.Token, userId); Dictionary <string, string> parameters = new Dictionary <string, string>() { { "token", ConfigurationManager.Instance.Token }, { "user", userId }, { "pretty", "1" }, }; var response = HTTPManager.GetRequest(url, ContentType, parameters); if (response.SuccessResponse == SuccessResponse.Successful) { userResponse = new JavaScriptSerializer().Deserialize <UserResponse>(response.Body); } } catch (Exception exception) { Console.WriteLine(exception); } return(userResponse); }
public void StartSession() { try { string url = @" https://slack.com/api/rtm.connect"; //string newURL = string.Format("{0}?token={1}&pretty=1", url, token); Dictionary <string, string> parameters = new Dictionary <string, string>() { { "token", ConfigurationManager.Instance.Token }, { "pretty", "1" }, }; var HttpCustomResponse = HTTPManager.GetRequest(url, ContentType, parameters); if (HttpCustomResponse.SuccessResponse == Models.SuccessResponse.Successful) { Console.WriteLine(HttpCustomResponse.Body); } } catch (Exception exception) { Console.WriteLine(exception); } }