You are on page 1of 2

1.

Instalar SlackBotMessages

2. Crear Clase SlackService para enviar SMS

using Microsoft.AspNetCore.Diagnostics;
using SlackBotMessages;
using SlackBotMessages.Models;
using System;
using System.Collections.Generic;

public class SlackService


{
public void SendMensage(IExceptionHandlerPathFeature e)
{
var client = new
SbmClient("https://hooks.slack.com/services/T01P3KH24SZ/B01P004EW2J/
7p7m8cY3gbFGJYAWyg1kEVTg");
var message = new Message
{
Channel = "alert-abgo",
Text = "-----AN EXCEPTION HAS OCCURED-----\n *"+e.Error+ "* \n In
Route:<<<<"+e.Path+">>>>",
IconEmoji = Emoji.Warning,
Username = "ABGO-SUPPORT", //Cambiar a Cportal-Support

};

client.Send(message);
}

3. Instanciar en Startup

readonly SlackService slack = new();

4. Utilizar el manejador de excepciones

You might also like