private static SimpleMessage createSimpleMessage(SlackMessage message) { SimpleMessage simpleMsg = new SimpleMessage() { Channel = message.Channel, Text = message.Pretext, Color = message.Color }; return(simpleMsg); }
//move to setup //public const String AcumaticaURL = "http://localhost/hackathon/(W(1))/Main.aspx?ScreenId="; //public const String SlackURL = "https://hooks.slack.com/services/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"; public static void postRequest(string SlackURL, SimpleMessage message) { try { using (var client = new HttpClient()) { var json = createJSON(message); var content = new StringContent(json, Encoding.UTF8, "application/json"); var result = client.PostAsync(SlackURL, content).Result; } } catch (Exception ex) { throw ex; } }