Example #1
0
        /// <summary>
        /// Post a message using a Payload object
        /// </summary>
        /// <param name="payload"></param>
        protected async void PostMessage(TeamPayload payload)
        {
            string payloadJson = JsonConvert.SerializeObject(payload);
            var    content     = new StringContent(payloadJson);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var client = new HttpClient();
            await client.PostAsync(new Uri(_Url), content);
        }
Example #2
0
        /// <summary>
        /// Post a message using simple strings
        /// </summary>
        /// <param name="text"></param>
        /// <param name="title"></param>
        protected void PostMessage(string text, string title)
        {
            TeamPayload payload = new TeamPayload()
            {
                Title = title,
                Text  = text,
            };

            PostMessage(payload);
        }