Quickstart
1. Create a project
dotnet new console -o MessagingDemo
cd MessagingDemo
dotnet add package Ratatosk
dotnet add package Ratatosk.Twilio2. Send an SMS
// Program.cs
using Ratatosk;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddMessaging()
.AddConnector<TwilioSmsConnector>("sms", cfg => cfg
.WithSettings("Twilio"))
.AddClient();
builder.Services.AddSingleton<NotificationService>();
var app = builder.Build();
app.Run();
// NotificationService.cs
public class NotificationService(IMessagingClient messagingClient)
{
public async Task<string?> SendSmsAsync(string to, string text)
{
var message = new MessageBuilder()
.WithId(Guid.NewGuid().ToString("n"))
.FromPhone("+15550001111")
.ToPhone(to)
.WithText(text)
.Build();
var result = await messagingClient.SendAsync("sms", message);
if (result.IsSuccess)
return result.Value?.RemoteMessageId;
throw new InvalidOperationException(
$"SMS failed: {result.Error?.Message}");
}
}3. Same code, different channel
4. Receive inbound messages (webhook)
5. Advanced resolution strategies
Resolution by name (named connectors)
Resolution by type (anonymous connectors)
Runtime resolution
Auto-initialization
Next steps
Last updated