Mattermost.NET 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mattermost.NET --version 3.0.0
                    
NuGet\Install-Package Mattermost.NET -Version 3.0.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="Mattermost.NET" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mattermost.NET" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Mattermost.NET" />
                    
Project file
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 Mattermost.NET --version 3.0.0
                    
#r "nuget: Mattermost.NET, 3.0.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.
#:package Mattermost.NET@3.0.0
                    
#: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=Mattermost.NET&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Mattermost.NET&version=3.0.0
                    
Install as a Cake Tool

GitHub Nuget Static Badge GitHub Actions Workflow Status NuGet version (Mattermost.NET) CodeFactor GitHub repo size

<a id="readme-top"></a>

Mattermost.NET

Ready-to-use .NET Standard library for convenient development of Mattermost bots.

Mattermost.NET is a production-ready .NET Standard library for building bots and integrations for the Mattermost platform. It provides a clean, strongly-typed C# interface over the Mattermost API, with support for messaging, channel management, file uploads, and real-time WebSocket updates. The client handles authentication, reconnection, and offers async methods for most operations. Published on NuGet under the MIT license.


Installation

The library is available as a NuGet package. You can install it using the NuGet Package Manager or the dotnet CLI.

dotnet add package Mattermost.NET

Usage

Create a new bot

using Mattermost.NET;
const string server = "https://mm.your-server.com"; // or https://community.mattermost.com by default
MattermostClient client = new(server);

Authenticate the bot with credentials

var botUser = await client.LoginAsync(username, password);
// Or you can use constructor if you have API key, ex. personal or bot token
// It will automatically authenticate the bot
const string token = "37VlFKySIZn6gryA85cR1GKBQkjmfRZ6";
MattermostClient client = new(server, token);

Subscribe to post updates

client.OnMessageReceived += ClientOnMessageReceived;

private static void ClientOnMessageReceived(object? sender, MessageEventArgs e)
{
    if (string.IsNullOrWhiteSpace(e.Message.Post.Text))
    {
        return;
    }
    e.Client.SendMessageAsync(e.Message.Post.ChannelId, "Hello, World!");
}

Start the bot updates

await client.StartReceivingAsync();

Note: The bot will automatically reconnect if the connection is lost. It's not required to call StartReceivingAsync if you don't want to receive updates through the WebSocket connection.

Stop the bot

await client.StopReceivingAsync();

The rest of the methods are implemented according to the Mattermost API. You can find them in IMattermostClient.

If you are looking for another methods, please visit the Mattermost API documentation and create an issue in the GitHub repository with what exact methods you need - I will add them as soon as possible.


License

Distributed under the MIT License. See LICENSE.md for more information.

Contact

E-Mail

Product 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 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.3 22 8/9/2025
3.0.2 36 8/9/2025
3.0.1 179 8/8/2025 3.0.1 is deprecated because it has critical bugs.
3.0.0 163 8/6/2025
2.0.3 91 7/31/2025
2.0.2 87 7/31/2025
2.0.1 89 7/29/2025
2.0.0 90 7/29/2025
1.0.5 87 7/29/2025
1.0.4 93 7/18/2025
1.0.3 99 7/18/2025
1.0.2 108 7/17/2025
1.0.1 219 6/24/2025
1.0.0 71 6/21/2025
0.4.0 70 6/20/2025
0.3.1 622 3/14/2025
0.3.0 366 3/5/2025
0.2.5 214 3/5/2025
0.2.4 1,166 2/21/2025
0.2.3 134 2/21/2025
0.2.2 177 2/9/2025
0.2.1 120 2/9/2025
0.2.0 110 2/9/2025
0.1.9 112 2/9/2025
0.1.8 940 9/16/2024
0.1.7 157 8/13/2024
0.1.6 133 8/10/2024
0.1.5 138 8/10/2024
0.1.4 132 8/10/2024
0.1.3 114 8/5/2024
0.1.2 107 7/31/2024
0.1.1 99 7/31/2024
0.1.0 116 7/30/2024