T1.SlackSdk
1.0.12
dotnet add package T1.SlackSdk --version 1.0.12
NuGet\Install-Package T1.SlackSdk -Version 1.0.12
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="T1.SlackSdk" Version="1.0.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="T1.SlackSdk" Version="1.0.12" />
<PackageReference Include="T1.SlackSdk" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add T1.SlackSdk --version 1.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: T1.SlackSdk, 1.0.12"
#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.
#:package T1.SlackSdk@1.0.12
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=T1.SlackSdk&version=1.0.12
#tool nuget:?package=T1.SlackSdk&version=1.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
T1.SlackSdk
An easy-to-use and comprehensive API for writing Slack apps in .NET.
Features
- Easy Integration: Simplified wrapper around SlackNet for easier Slack app development
- Progress Messages: Built-in support for sending progress messages to Slack channels
- History Management: Easy retrieval of Slack message history with thread support
- User Management: Simplified user information handling with caching
- Configuration: Streamlined configuration management using Microsoft.Extensions.Options
Installation
dotnet add package T1.SlackSdk
Quick Start
Basic Setup
// Configure Slack client using dependency injection
services.Configure<SlackConfig>(options =>
{
options.Token = "your-bot-token";
});
services.AddScoped<ISlackClient, SlackClient>();
// Or create directly
var slackConfig = new SlackConfig
{
Token = "your-bot-token"
};
var slackClient = new SlackClient(Options.Create(slackConfig));
Send Progress Messages
// Send initial progress message
var progressArgs = new SendProgressMessageArgs
{
ChannelId = "channel-id",
ProgressMessage = "🔄 Task processing started...",
Username = "Bot",
Ts = "thread-timestamp" // Optional: for thread replies
};
await slackClient.SendProgressMessageAsync(progressArgs);
// Send finish message
var finishArgs = new SendFinishProgressMessageArgs
{
ChannelId = "channel-id",
Ts = "original-message-timestamp",
FinishMessage = "✅ Processing completed!",
Message = "Result: All tasks completed successfully"
};
await slackClient.SendFinishProgressMessageAsync(finishArgs);
Get Message History
var historyArgs = new GetHistoryArgs
{
ChannelId = "channel-id",
Range = new DateTimeRange
{
Start = DateTime.Now.AddDays(-7),
End = DateTime.Now
}
};
var history = await slackClient.GetHistoryAsync(historyArgs);
foreach (var item in history)
{
Console.WriteLine($"User: {item.User.Name}, Message: {item.Text}, Time: {item.Time}");
// Access thread messages
foreach (var threadMsg in item.ThreadMessages)
{
Console.WriteLine($" Thread: {threadMsg.Text}");
}
}
Get User Information
var user = await slackClient.GetUserInfoAsync("user-id");
Console.WriteLine($"User: {user.Name}, Email: {user.Email}");
Configuration
The SlackConfig
class supports the following properties:
Token
: Your Slack bot token (required)
Dependencies
- .NET 8.0
- SlackNet 0.13.3
- Microsoft.Extensions.Options 8.0.2
- T1.Standard 1.0.81
Features Details
Message History
- Retrieves messages with full thread support
- Includes user information for each message
- Supports date range filtering
- Automatic caching for user information (10-minute cache)
Progress Messages
- Send initial progress messages with custom text
- Update messages to show completion status
- Support for threaded conversations
- Customizable usernames and messages
User Management
- Cached user information retrieval
- Automatic cache invalidation
- Efficient API usage with method caching
License
MIT License - see LICENSE for details.
Contributing
Feel free to submit issues and enhancement requests!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.Options (>= 8.0.2)
- SlackNet (>= 0.13.3)
- T1.Standard (>= 1.0.81)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
add limit