Skip to content

feat: implement SignalWire SMS provider (US / Global) #53

Open

Description

@teesofttech

Summary

Implement the SignalWire SMS provider inside src/SmsBridge/Providers/SignalWire/.

SignalWire provides SMS/MMS through its compatibility messaging API. This adds another US/global CPaaS provider, especially useful for teams already using SignalWire spaces and phone numbers.

Official docs:

Files to create

  • src/SmsBridge/Providers/SignalWire/SignalWireSmsProvider.cs
  • src/SmsBridge/Providers/SignalWire/SignalWireSmsRequestMapper.cs
  • src/SmsBridge/Providers/SignalWire/SignalWireSmsResponseMapper.cs
  • src/SmsBridge/Options/SignalWireOptions.cs
  • Register UseSignalWire() in src/SmsBridge/DependencyInjection/SmsBridgeProviderBuilder.cs
  • Add HttpClientNames.SignalWire in src/SmsBridge/Internal/Http/HttpClientNames.cs
  • Add SmsProviderType.SignalWire to the enum

SignalWire API Details

  • Base URL: https://{SpaceName}.signalwire.com/api/laml/2010-04-01
  • Send endpoint: POST /Accounts/{ProjectId}/Messages.json
  • Auth: HTTP Basic Auth using Project ID and API token
  • Request form fields:
    From=+15551234567
    To=+15557654321
    Body=Hello from SMSBridge
    
  • Response is Twilio-compatible and includes fields such as sid, status, to, from, and body.

Options

public sealed class SignalWireOptions
{
    public required string SpaceName { get; init; }
    public required string ProjectId { get; init; }
    public required string ApiToken { get; init; }
    public required string From { get; init; }
}

Implementation Notes

  • Use form URL encoded requests, matching compatibility API expectations.
  • Use sid as the provider message id for accepted sends.
  • The response shape is close to Twilio, but keep a dedicated mapper to avoid coupling provider-specific status behavior.
  • Support E.164 numbers.

Tests to add

  • tests/SmsBridge.ProviderTests/SignalWireResponseMapperTests.cs
  • tests/SmsBridge.ProviderTests/SignalWireProviderTests.cs

Acceptance Criteria

  • Provider sends via /Accounts/{ProjectId}/Messages.json using IHttpClientFactory
  • Provider uses HTTP Basic Auth with ProjectId:ApiToken
  • Request mapper emits From, To, and Body
  • Response mapper maps sid to SmsSendResult.ProviderMessageId
  • Provider maps rejected statuses/errors to failed SmsSendResult
  • Transient HTTP failures set IsTransientFailure = true
  • UseSignalWire() registers the provider in DI
  • All tests pass - dotnet test
  • dotnet build has 0 warnings

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions