RocketNet.Chat
1.2.0
dotnet add package RocketNet.Chat --version 1.2.0
NuGet\Install-Package RocketNet.Chat -Version 1.2.0
<PackageReference Include="RocketNet.Chat" Version="1.2.0" />
<PackageVersion Include="RocketNet.Chat" Version="1.2.0" />
<PackageReference Include="RocketNet.Chat" />
paket add RocketNet.Chat --version 1.2.0
#r "nuget: RocketNet.Chat, 1.2.0"
#:package RocketNet.Chat@1.2.0
#addin nuget:?package=RocketNet.Chat&version=1.2.0
#tool nuget:?package=RocketNet.Chat&version=1.2.0
<img src="https://raw.githubusercontent.com/ai-iskuzhin/RocketNet.Chat/main/assets/logo.png" width="128" alt="RocketNet.Chat logo" />
RocketNet.Chat
Unofficial .NET SDK for the Rocket.Chat REST API — find a user by username or email, open the private chat with them, and post a message.
Not affiliated with Rocket.Chat Technologies Corp.; developed independently.
Install
dotnet add package RocketNet.Chat
Targets netstandard2.0, net8.0 and net10.0.
Quick start
using RocketNet.Chat;
using var httpClient = new HttpClient();
var client = new RocketChatClient(httpClient, new RocketChatClientOptions
{
BaseAddress = new Uri("https://chat.example.com/"), // workspace root, not the API root
UserId = "rbAXPnMktTFbNpwtJ", // My Account → Personal Access Tokens
AuthToken = "RScctEHSmLGZ..." // keep it in secrets
});
// Look the user up, open the private chat, post into it.
var posted = await client.SendDirectMessageAsync(
RocketChatUserQuery.ByEmail("kim@example.com"),
"Deploy finished ✅");
Console.WriteLine(posted.Message?.Id);
Supported methods
| Step | Client API | HTTP |
|---|---|---|
| Sign in with a password | LoginAsync |
POST /api/v1/login |
| Find a user (throws when missing) | FindUserAsync |
GET /api/v1/users.info |
| Find a user (null when missing) | TryFindUserAsync |
GET /api/v1/users.info |
| Open the private chat | CreateDirectMessageAsync |
POST /api/v1/dm.create |
| Post a message | PostMessageAsync |
POST /api/v1/chat.postMessage |
| All three, in one call | SendDirectMessageAsync |
the three above, in order |
| Read room history | GetHistoryAsync |
channels.history / groups.history / dm.history |
| Resolve a room by name | GetRoomAsync |
channels.info / groups.info |
| Unread counts | GetCountersAsync |
channels.counters / groups.counters / dm.counters |
| Mark read / unread | MarkAsReadAsync, MarkAsUnreadAsync, MarkAsUnreadFromAsync |
subscriptions.read / subscriptions.unread |
| Custom emoji (list, delta sync) | GetCustomEmojisAsync, GetUpdatedCustomEmojisAsync |
emoji-custom.all / emoji-custom.list |
| Absolute URL for attached media | BuildFileUri |
— (no network) |
Reading a channel, including any uploaded media:
var page = await client.GetHistoryAsync(
RocketChatRoomQuery.Channel("#channel_test"),
new RocketChatHistoryOptions { Count = 50 });
foreach (var message in page.WithFiles)
foreach (var attachment in message.FileAttachments)
Console.WriteLine(client.BuildFileUri(attachment.FileUrl!));
A private channel is a group in the API — address it with RocketChatRoomQuery.PrivateChannel(...),
not Channel(...).
Authenticate with a personal access token through RocketChatClientOptions, or exchange a password
for a session with LoginAsync and pass it per call. Every method accepts an optional
RocketChatSession that overrides the configured credentials.
Errors derive from RocketChatException: RocketChatValidationException (rejected locally),
RocketChatTransportException (no response), RocketChatApiException (the workspace said no) and
RocketChatProtocolException (unreadable response).
Full documentation: https://github.com/ai-iskuzhin/RocketNet.Chat.
License
MIT.
| 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 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 is compatible. 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 | 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 was computed. |
| .NET Framework | net461 was computed. net462 was computed. 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. |
-
.NETStandard 2.0
- System.Text.Json (>= 8.0.6)
-
net10.0
- No dependencies.
-
net8.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.