Skip to content

feat: implement Textmagic SMS provider (UK / Global) #26

Open

Description

@teesofttech

Summary

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

Textmagic is a UK-based business SMS platform with global reach. It is commonly used by small and medium businesses in the UK and Europe.

Files to create

  • src/SmsBridge/Providers/Textmagic/TextmagicSmsProvider.cs
  • src/SmsBridge/Providers/Textmagic/TextmagicSmsRequestMapper.cs
  • src/SmsBridge/Providers/Textmagic/TextmagicSmsResponseMapper.cs
  • src/SmsBridge/Options/TextmagicOptions.cs
  • Register UseTextmagic() in src/SmsBridge/DependencyInjection/SmsBridgeProviderBuilder.cs
  • Add HttpClientNames.Textmagic in src/SmsBridge/Internal/Http/HttpClientNames.cs
  • Add SmsProviderType.Textmagic to the enum

Textmagic API Details

  • Endpoint: https://rest.textmagic.com/api/v2/messages
  • Auth: X-TM-Username and X-TM-Key headers
  • Request (JSON):
    { "text": "...", "phones": "...", "from": "..." }
  • Response: { "id": ..., "href": "...", "type": "message", "sessionId": ... }

Options

public sealed class TextmagicOptions
{
    public required string Username { get; init; }
    public required string ApiKey { get; init; }
    public required string From { get; init; }
}

Tests to add

  • tests/SmsBridge.ProviderTests/TextmagicResponseMapperTests.cs
  • tests/SmsBridge.ProviderTests/TextmagicProviderTests.cs

Acceptance Criteria

  • Provider sends via Textmagic REST API using IHttpClientFactory
  • X-TM-Username and X-TM-Key headers are set correctly
  • Response mapper extracts id as the provider message ID
  • Transient failures set IsTransientFailure = true
  • UseTextmagic() registers the provider in DI
  • All tests pass — dotnet test
  • dotnet build has 0 warnings
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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions