A basic example of how to integrate with ASP.NET Core.
- Create an app on the Slack developer website. Follow the prompts, selecting the "from scratch" option, rather than the app manifest option.
- Request the bot token scopes required by the demo:
users:read
channels:read
groups:read
im:read
mpim:read
for getting user & conversation info.chat:write
for posting messages.
- Install the app to your workspace and copy the bot user OAuth token from your app's OAuth & Permissions page into the demo's appsettings.json file for the value of the
ApiToken
. - Copy the signing secret from the Basic Information page of you app's settings to the
SigningSecret
value in appsettings.json. - Host the web site publicly (see below). You'll need the site up and running for the next step.
- Enable events for your app, and set the request URL to
https://<your site's base URL>/slack/event
. Slack will check that your web site is up and responding to requests. - Subscribe to the
message.channels
message.groups
message.im
message.mpim
events in order to receive messages. - Add your app to any channels/groups etc. you want it to respond to.
- Say "ping" to get back a "pong".
These URLs aren't used by this example, but may be required for more advanced apps.
- For interactivity & shortcuts:
- Use
https://<your site's base URL>/slack/action
for the Interactivity Request URL. - Use
https://<your site's base URL>/slack/options
for the Select Menus Options Load URL.
- Use
- For slash commands:
- Use
https://<your site's base URL>/slack/command
for the Request URL.
- Use
For Slack to be able to send your web site requests, it must be hosted with a publicly accessible HTTPS address. Some popular hosting services for ASP.NET apps include Azure, AWS, and Google Cloud.
Justin Gerber has written a good blog post that walks you through setting up a Slack app and hosting it in AWS.