Skip to content

feat: implement MSG91 SMS provider (India) #21

Open

Description

@teesofttech

Summary

Implement the MSG91 SMS provider inside src/SmsBridge/Providers/Msg91/.

MSG91 is one of the leading enterprise SMS and OTP providers in India.

Files to create

  • src/SmsBridge/Providers/Msg91/Msg91SmsProvider.cs
  • src/SmsBridge/Providers/Msg91/Msg91SmsRequestMapper.cs
  • src/SmsBridge/Providers/Msg91/Msg91SmsResponseMapper.cs
  • src/SmsBridge/Options/Msg91Options.cs
  • Register UseMsg91() in src/SmsBridge/DependencyInjection/SmsBridgeProviderBuilder.cs
  • Add HttpClientNames.Msg91 in src/SmsBridge/Internal/Http/HttpClientNames.cs
  • Add SmsProviderType.Msg91 to the enum

MSG91 API Details

  • Endpoint: https://control.msg91.com/api/v5/flow/
  • Auth: authkey header
  • Request (JSON):
    {
      "flow_id": "...",
      "sender": "...",
      "mobiles": "...",
      "VAR1": "..."
    }
  • Simple SMS (non-template): https://api.msg91.com/api/v5/otp or transactional endpoint
  • Response: { "type": "success", "message": "..." }

Note: MSG91 uses template-based flows for most messages in India (due to DLT regulations). Document this limitation clearly in the options.

Options

public sealed class Msg91Options
{
    public required string AuthKey { get; init; }
    public required string From { get; init; }
    public string? TemplateFlowId { get; init; }
}

Tests to add

  • tests/SmsBridge.ProviderTests/Msg91ResponseMapperTests.cs
  • tests/SmsBridge.ProviderTests/Msg91ProviderTests.cs

Acceptance Criteria

  • Provider sends via MSG91 REST API using IHttpClientFactory
  • Response mapper checks type == "success"
  • Transient failures set IsTransientFailure = true
  • DLT/template limitation is documented in Msg91Options XML comments
  • UseMsg91() 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