Skip to content

feat: implement BulkSMSNigeria SMS provider (Nigeria) #49

Description

@teesofttech

Summary

Implement the BulkSMSNigeria SMS provider inside src/SmsBridge/Providers/BulkSmsNigeria/.

BulkSMSNigeria is a Nigeria-focused SMS gateway with a documented REST API, DND delivery support, delivery reports, sender IDs, and a sandbox endpoint. This adds stronger local Nigerian coverage beyond Termii and SmartSMSSolutions.

Official docs:

Files to create

  • src/SmsBridge/Providers/BulkSmsNigeria/BulkSmsNigeriaSmsProvider.cs
  • src/SmsBridge/Providers/BulkSmsNigeria/BulkSmsNigeriaSmsRequestMapper.cs
  • src/SmsBridge/Providers/BulkSmsNigeria/BulkSmsNigeriaSmsResponseMapper.cs
  • src/SmsBridge/Options/BulkSmsNigeriaOptions.cs
  • Register UseBulkSmsNigeria() in src/SmsBridge/DependencyInjection/SmsBridgeProviderBuilder.cs
  • Add HttpClientNames.BulkSmsNigeria in src/SmsBridge/Internal/Http/HttpClientNames.cs
  • Add SmsProviderType.BulkSmsNigeria to the enum

BulkSMSNigeria API Details

  • Production base URL: https://www.bulksmsnigeria.com/api/v2
  • Sandbox base URL: https://www.bulksmsnigeria.com/api/sandbox/v2
  • Send endpoint: POST /sms
  • Auth: Authorization: Bearer {ApiToken}
  • Request (JSON):
    {
      "from": "SMSBridge",
      "to": "2348012345678",
      "body": "Hello from SMSBridge",
      "gateway": "direct-refund",
      "callback_url": "https://example.com/sms/callback"
    }
  • Response fields documented include status, code, message, data.message_id, cost, currency, recipients_count, and gateway_used.

Options

public sealed class BulkSmsNigeriaOptions
{
    public required string ApiToken { get; init; }
    public required string From { get; init; }
    public string? Gateway { get; init; }
    public string? CallbackUrl { get; init; }
    public bool UseSandbox { get; init; }
}

Implementation Notes

  • Prefer JSON request/response handling.
  • Use the sandbox base URL when UseSandbox is enabled.
  • Map data.message_id to SmsSendResult.ProviderMessageId.
  • Treat non-success status/code values as failed sends.
  • Preserve gateway_used, cost, and currency in provider metadata if SMSBridge supports metadata for send results.

Tests to add

  • tests/SmsBridge.ProviderTests/BulkSmsNigeriaResponseMapperTests.cs
  • tests/SmsBridge.ProviderTests/BulkSmsNigeriaProviderTests.cs

Acceptance Criteria

  • Provider sends via /sms using IHttpClientFactory
  • Provider supports production and sandbox base URLs
  • Request mapper emits from, to, body, optional gateway, and optional callback_url
  • Response mapper maps data.message_id to SmsSendResult.ProviderMessageId
  • Provider maps failed BulkSMSNigeria responses to failed SmsSendResult
  • Transient HTTP failures set IsTransientFailure = true
  • UseBulkSmsNigeria() registers the provider in DI
  • All tests pass - dotnet test
  • dotnet build has 0 warnings

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