This repository was archived by the owner on Oct 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Examples
James Marcogliese edited this page Feb 27, 2019
·
9 revisions
using Slack.Api.CSharp.WebApi;
string accessToken = "xoxp-EXAMPLE-ACCESS-TOKEN";
string channel = "D0PNCRP9N";
string message = "This is a test message!";
ISlackWebAPI slackWebAPI = new SlackWebAPI();
PostMessageOKResponse res = slackWebAPI.Chat.PostMessage(token: accessToken, text: message, channel: channel); using Slack.Api.CSharp.WebApi;
string accessToken = "xoxp-EXAMPLE-ACCESS-TOKEN";
string channel = "D0PNCRP9N";
string message = "This is a test message!";
ISlackWebAPI slackWebAPI = new SlackWebAPI();
PostMessageOKResponse res = await slackWebAPI.Chat.PostMessageAsync(token: accessToken, text: message, channel: channel); using Slack.Api.CSharp.EventsApi;
namespace slackBot.Controllers
{
[Route("events")]
[ApiController]
public class EventsController : ControllerBase
{
[HttpPost]
public IActionResult Event([FromBody]SlackEvent request) // JSON will automatically map to SlackEvent object.
{
// DoSomething();
}
}
}using Slack.Api.CSharp.EventsApi;
namespace slackBot.Controllers
{
[Route("events")]
[ApiController]
public class EventsController : ControllerBase
{
[HttpPost]
public IActionResult Event([FromBody]SlackAction request) // JSON will automatically map to SlackAction object.
{
// DoSomething();
}
}
}