Slack.Integration
1.3.0
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
dotnet add package Slack.Integration --version 1.3.0
NuGet\Install-Package Slack.Integration -Version 1.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Slack.Integration" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Slack.Integration --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Slack.Integration, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Slack.Integration as a Cake Addin #addin nuget:?package=Slack.Integration&version=1.3.0 // Install Slack.Integration as a Cake Tool #tool nuget:?package=Slack.Integration&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Slack.Integration
This library provides Slack APIs. You can integrate your service and Slack. Currently support is only Incoming Webhook.
- Incoming Webhook
- Slash Command
- Easy to pass known colors and emojis
Support Platform
- .NET Framework 4.6.2+
- .NET Standard 2.0+
- .NET 8.0+
Incoming Webhook
Super easy to use.
var url = "<Your Incoming Webhook URL here.>";
var payload = new Payload { Text = "Hello, Slack!!" };
var client = new WebhookClient();
await client.SendAsync(url, payload);
Following is payload sample.
var payload = new Payload
{
UserName = "Incoming Webhook",
Text = "Hello, @xin9le !!\n\nThis posts is test for _Incoming WebHook_ .\nDocument is <https://api.slack.com/incoming-webhooks|here>.",
Markdown = true,
Channel = "#random", // override channel
LinkNames = true,
IconEmoji = KnownEmoji.PlusOne,
Attachments = new []
{
new Attachment
{
Fallback = "脱・読みづらいコード!今日から一段上のプログラマーになる方法 5 選",
Color = Color.AliceBlue.ToHex(),
PreText = "This text is optional that is displayed at the top of _attachment block_ .",
AuthorName = "xin9le",
AuthorLink = "http://xin9le.net",
AuthorIcon = "https://pbs.twimg.com/profile_images/1047114972118114305/vw07RO7H_normal.jpg",
Title = "脱・読みづらいコード!今日から一段上のプログラマーになる方法 5 選",
TitleLink = "http://blog.xin9le.net/entry/2016/02/26/043557",
Text = "「ソースコードを綺麗に書く」というのは、プログラマーであれば誰しもが心掛けたいと思っている *極めて重要な事柄* です。そもそも「綺麗なコードってなんぞ?」という感じですが、いくつかあると思います。",
ImageUrl = "http://cdn-ak.f.st-hatena.com/images/fotolife/x/xin9le/20160226/20160226040749.png",
ThumbUrl = "https://pbs.twimg.com/profile_images/1047114972118114305/vw07RO7H_normal.jpg",
Footer = "xin9le",
FooterIcon = "https://pbs.twimg.com/profile_images/1047114972118114305/vw07RO7H_normal.jpg",
Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(),
Fields = new []
{
new Field
{
Title = "Unique User",
Value = "345",
Short = true,
},
new Field
{
Title = "Page View",
Value = "12345",
Short = true,
},
},
Actions = new []
{
new Slack.Integration.IncomingWebhook.Action
{
Type = ActionType.Button,
Text = "GitHub",
Url = "https://github.com/xin9le",
Style = ActionStyle.Default,
},
new Slack.Integration.IncomingWebhook.Action
{
Type = ActionType.Button,
Text = "Blog",
Url = "https://blog.xin9le.net",
Style = ActionStyle.Primary,
},
new Slack.Integration.IncomingWebhook.Action
{
Type = ActionType.Button,
Text = "Twitter",
Url = "https://twitter.com/xin9le",
Style = ActionStyle.Danger,
},
},
},
},
};
Slash Command
Slash Command requests sent from Slack can be mapped as follows.
using Microsoft.AspNetCore.Mvc;
using Slack.Integration.SlashCommand;
public class SlashCommandController : Controller
{
[HttpPost]
public IAsyncResult DoSomething([FromForm]Request request) // request mapping
{
// do something
return this.Ok();
}
}
Installation
Getting started from downloading NuGet package.
dotnet add package Slack.Integration
License
This library is provided under MIT License.
Author
Takaaki Suzuki (a.k.a @xin9le) is software developer in Japan who awarded Microsoft MVP for Developer Technologies (C#) since July 2012.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- System.Net.Http.Json (>= 6.0.2)
-
.NETStandard 2.0
- System.Net.Http.Json (>= 6.0.2)
-
.NETStandard 2.1
- System.Net.Http.Json (>= 6.0.2)
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.