Created
February 25, 2021 02:40
-
-
Save vmussak/192a3acc4768bac74b9647c0e68d31ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MicrosoftTeamsIntegrationExample.MicrosoftTeams; | |
using Newtonsoft.Json; | |
using System; | |
using System.Net.Http; | |
using System.Text; | |
namespace MicrosoftTeamsIntegrationExample | |
{ | |
public class MicrosoftTeamsService | |
{ | |
private static readonly HttpClient HttpClient = new HttpClient(); | |
public void SendMicrosoftTeamsMessage(MicrosoftTeamsRequest request) | |
{ | |
var url = "SUA URL DO TEAMS AQUI"; | |
var jsonRequest = JsonConvert.SerializeObject(request); | |
var response = HttpClient.PostAsync( | |
url, | |
new StringContent(jsonRequest, Encoding.UTF8, "application/json") | |
).Result; | |
if(response.IsSuccessStatusCode) | |
{ | |
Console.WriteLine("Mensagem enviada ao MS Teams"); | |
} | |
else | |
{ | |
Console.WriteLine("Erro ao enviar mensagem ao MS Teams"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment