https://github.com/soenneker/soenneker.blazor.chatwoot
A Blazor interop library for Chatwoot, the open-source customer engagement suite.
https://github.com/soenneker/soenneker.blazor.chatwoot
blazor blazorlibrary chat chatwoot chatwootinterop csharp customer dotnet engagement interop live
Last synced: about 1 month ago
JSON representation
A Blazor interop library for Chatwoot, the open-source customer engagement suite.
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.blazor.chatwoot
- Owner: soenneker
- License: mit
- Created: 2025-04-06T01:46:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-01T01:10:01.000Z (about 1 month ago)
- Last Synced: 2026-05-01T02:20:16.438Z (about 1 month ago)
- Topics: blazor, blazorlibrary, chat, chatwoot, chatwootinterop, csharp, customer, dotnet, engagement, interop, live
- Language: CSS
- Homepage: https://soenneker.com
- Size: 1.68 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.blazor.chatwoot/)
[](https://github.com/soenneker/soenneker.blazor.chatwoot/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.blazor.chatwoot/)
[](https://github.com/soenneker/soenneker.blazor.chatwoot/actions/workflows/codeql.yml)
#  Soenneker.Blazor.Chatwoot
### A Blazor interop library for [Chatwoot](https://www.chatwoot.com/), the open-source customer engagement suite.
---
## ? Features
- ?? Lightweight Blazor component wrapper for the Chatwoot JS SDK
- ?? Full .NET interop with JavaScript events
- ?? Supports event callbacks like `OnOpen`, `OnMessage`, and `OnError`
- ?? Clean integration using dependency injection
- ?? Supports unit testing with `IChatwoot` abstraction
---
## ?? Installation
```bash
dotnet add package Soenneker.Blazor.Chatwoot
```
Register the interop in DI:
```csharp
public static async Task Main(string[] args)
{
builder.Services.AddChatwootInteropAsScoped();
}
```
---
## ?? Usage
### ?? Add to a Razor component
```razor
```
### ?? Component code-behind
```csharp
@code {
private readonly ChatwootConfiguration _config = new()
{
WebsiteToken = "replace-with-your-token",
BaseUrl = "https://app.chatwoot.com"
};
private Task HandleReady() => ConsoleLog("Chatwoot is ready!");
private Task HandleOpen() => ConsoleLog("Chat opened");
private Task HandleClose() => ConsoleLog("Chat closed");
private Task HandleMessage(ChatwootMessage message)
{
Console.WriteLine($"Message from Chatwoot: {message.Content}");
return Task.CompletedTask;
}
private Task HandleError(JsonElement error)
{
Console.WriteLine($"Chatwoot error: {error}");
return Task.CompletedTask;
}
private Task ConsoleLog(string msg)
{
Console.WriteLine(msg);
return Task.CompletedTask;
}
}
```
---
## ?? Configuration
You must supply a `ChatwootConfiguration` object to the component:
```csharp
var config = new ChatwootConfiguration
{
WebsiteToken = "your-token", // Required
BaseUrl = "https://app.chatwoot.com", // Optional, defaults to this
Locale = "en", // Optional, default is "en"
HideMessageBubble = false,
ShowUnreadMessagesDialog = false,
Position = "right", // "left" or "right"
UseBrowserLanguage = false,
Type = "standard", // or "expanded_bubble"
DarkMode = "auto", // "light" or "auto"
BaseDomain = null // Optional, for cross-subdomain tracking
};
```
## ?? API
This library provides a full interface via `IChatwoot`, including:
- `SetUser(...)`
- `SetLabel(...)`
- `Shutdown()`
- `Toggle()`
- `SetLocale(...)`
- `SetCustomAttributes(...)`
- ... and more!
---
## ?? Chatwoot Events
The following Chatwoot events are exposed as Blazor `EventCallback`s:
| Chatwoot Event | .NET Callback |
|----------------------|--------------------------|
| `chatwoot:ready` | `OnReady` |
| `chatwoot:open` | `OnOpen` |
| `chatwoot:close` | `OnClose` |
| `chatwoot:on-message`| `OnMessage(ChatwootMessage)` |
| `chatwoot:error` | `OnError(JsonElement)` |