1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | using System; using System.IO; using System.Net; using System.Text; namespace TeamRoomTest { class Program { static void Main( string [] args) { try { // Webhook URL // Send Message string sendMessage = "테스트입니당~" ; ASCIIEncoding encoding = new ASCIIEncoding(); byte [] data = encoding.GetBytes( string .Format( "content={0}" , System.Web.HttpUtility.UrlEncode(sendMessage))); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(webHookUrl); req.Timeout = 5000; req.Method = "POST" ; req.ContentType = "application/x-www-form-urlencoded" ; req.ContentLength = data.Length; Stream dataStream = req.GetRequestStream(); dataStream.Write(data, 0, data.Length); dataStream.Close(); req.GetResponse(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } } |
※ Webhook url 은 네이트온의 팀룸을 열면 팀룸메뉴 -> 오픈 API 이용하기 -> 새로 연결하기 또는 편집으로 들어가면 확인 가능하다.