Sending automatic messages to Slack from ASP.NET Core with Hangfire

Mircea Oprea
StreamWriter
Published in
6 min readFeb 20, 2020

--

This tutorial explores how to post automatic messages on a Slack channel, by using ASP.NET Core and Hangfire. The assumption is that you already have a web application developed with ASP.NET Core. If you would like to learn how to develop full-stack applications with ASP.NET Core, you can check my e-book on this subject, which touches WebAPI (for back-end), Blazor (for front-end )and Hangfire (for background tasks).

Creating a “bot” that sends messages to your Slack channel is a great way to engage with your colleagues. You can let them know when an important event happens in the application, such as someone buying your product, you can send them reminders, or you can make it post a funny message to brighten their day.

1. Setting up Slack

The first thing you will need is a Slack workspace, and a channel where to post the messages. You can create a workspace here, if you do not already have one.

Once logged in to your Slack account, navigate to the apps dashboard to create a new Slack application.

Once here, click the “Create New App” button and fill in the information:

--

--