Documentation Index
Fetch the complete documentation index at: https://orbit-docs.devotel.io/llms.txt
Use this file to discover all available pages before exploring further.
C# SDK
The official Orbit .NET SDK provides a strongly-typed client for the Orbit API. Built for .NET 8+, it supports all Orbit services with async/await, automatic retries, dependency injection, and structured error handling.
Installation
dotnet add package Devotel.Orbit
Or via the NuGet Package Manager:
Install-Package Devotel.Orbit
Quick Start
using Devotel.Orbit;
var orbit = new Orbit("dv_live_sk_your_key_here");
// Send an SMS
var message = await orbit.Messages.SendAsync("+14155552671", "Hello from Orbit!", "sms");
Console.WriteLine(message); // {data: {message_id: msg_abc123, ...}}
Dependency Injection
Register the Orbit client in your ASP.NET Core services:
// Program.cs
builder.Services.AddOrbitClient(options =>
{
options.ApiKey = builder.Configuration["Devotel:ApiKey"];
});
Then inject and use:
public class MessagingService
{
private readonly IOrbitClient _orbit;
public MessagingService(IOrbitClient orbit) => _orbit = orbit;
public async Task SendWelcome(string phoneNumber)
{
await _orbit.Messages.SendAsync(new SendMessageRequest
{
Channel = "sms",
To = phoneNumber,
Body = "Welcome to our service!"
});
}
}
Messaging
// Send WhatsApp message
var waMessage = await orbit.Messages.SendWhatsAppAsync("+14155552671", "Hello from Orbit on WhatsApp!");
// Send Email
var email = await orbit.Messages.SendEmailAsync("user@example.com", "Welcome!", "<h1>Welcome to Acme</h1>");
// Send SMS shorthand
var sms = await orbit.Messages.SendSmsAsync("+14155552671", "Quick SMS hello!");
Voice
// Make an outbound call
var call = await orbit.Voice.CreateCallAsync("+14155552671", "+18005551234");
// Retrieve call details
var callDetails = await orbit.Voice.GetCallAsync(call.GetProperty("data").GetProperty("id").GetString()!);
Verify
// Send OTP
var verification = await orbit.Verify.SendAsync("+14155552671", "sms");
// Check OTP
var verificationId = verification.GetProperty("data").GetProperty("verification_id").GetString()!;
var result = await orbit.Verify.CheckAsync(verificationId, "482901");
Console.WriteLine(result.GetProperty("data").GetProperty("status")); // "approved"
Webhooks
using Devotel.Orbit.Webhooks;
// ASP.NET Core Minimal API
app.MapPost("/webhooks/orbit", async (HttpContext context) =>
{
var payload = await new StreamReader(context.Request.Body).ReadToEndAsync();
var signature = context.Request.Headers["X-Devotel-Signature"].ToString();
if (!WebhookVerifier.Verify(payload, signature, "whsec_your_secret"))
{
return Results.Unauthorized();
}
var webhookEvent = WebhookEvent.Parse(payload);
switch (webhookEvent.Type)
{
case "message.delivered":
// Handle delivery
break;
case "call.completed":
// Handle call completion
break;
}
return Results.Ok(new { received = true });
});
Error Handling
try
{
await orbit.Messages.SendAsync("invalid", "Hi", "sms");
}
catch (DevotelApiException ex)
{
Console.Error.WriteLine(ex.Code); // "INVALID_PHONE_NUMBER"
Console.Error.WriteLine(ex.StatusCode); // 422
Console.Error.WriteLine(ex.Message); // "The to field must be a valid E.164 phone number"
}
Configuration
var orbit = new Orbit("dv_live_sk_your_key_here");
// Or with a custom base URL
var orbitCustom = new Orbit("dv_live_sk_your_key_here", "https://orbit-api.devotel.io/api/v1");
| Option | Type | Default | Description |
|---|
apiKey | string | — | Your Devotel API key (required) |
baseUrl | string | https://orbit-api.devotel.io/api/v1 | API base URL |
Requirements
- .NET 8.0 or later
- No external dependencies (uses
System.Net.Http.HttpClient)