Eaf.Notifications.Sms 9.4.6

Prefix Reserved
dotnet add package Eaf.Notifications.Sms --version 9.4.6
                    
NuGet\Install-Package Eaf.Notifications.Sms -Version 9.4.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Eaf.Notifications.Sms" Version="9.4.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Eaf.Notifications.Sms" Version="9.4.6" />
                    
Directory.Packages.props
<PackageReference Include="Eaf.Notifications.Sms" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Eaf.Notifications.Sms --version 9.4.6
                    
#r "nuget: Eaf.Notifications.Sms, 9.4.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Eaf.Notifications.Sms@9.4.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Eaf.Notifications.Sms&version=9.4.6
                    
Install as a Cake Addin
#tool nuget:?package=Eaf.Notifications.Sms&version=9.4.6
                    
Install as a Cake Tool

Eaf.Notifications.Sms

Módulo de envio de SMS para o Enterprise Application Foundation (EAF). Fornece abstrações e providers configuráveis para gateways como Zenvia, Twilio, AWS SNS e qualquer provedor HTTP genérico.

Dependências

  • Abp (>= 10.5.0)
  • Microsoft.Extensions.Http (>= 10.0.9)

Configuração

{
  "Eaf": {
    "Sms": {
      "Provider": "GenericHttp",
      "DefaultFrom": "EAF",
      "GenericHttp": {
        "BaseUrl": "https://api.zenvia.com",
        "Endpoint": "/services/send-sms",
        "AuthenticationType": "Basic",
        "Username": "zenvia-user",
        "Password": "zenvia-pass",
        "ContentType": "Json",
        "Template": "{\"sendSmsRequest\":{\"from\":\"{{from}}\",\"to\":\"{{phoneNumber}}\",\"msg\":\"{{body}}\"}}"
      }
    }
  }
}

Exemplo para Twilio:

{
  "Eaf": {
    "Sms": {
      "Provider": "Twilio",
      "DefaultFrom": "+15551234567",
      "Twilio": {
        "AccountSid": "AC...",
        "AuthToken": "...",
        "From": "+15551234567"
      }
    }
  }
}

Uso

public class MyAppService : ApplicationService
{
    private readonly ISmsSender _smsSender;

    public MyAppService(ISmsSender smsSender)
    {
        _smsSender = smsSender;
    }

    public async Task SendAsync()
    {
        await _smsSender.SendAsync(new SmsMessage
        {
            PhoneNumber = "+5511987654321",
            Body = "Código de verificação: 123456"
        });
    }
}

Providers

  • GenericHttpSmsProvider — provider genérico para APIs REST de SMS (Zenvia, customizadas etc.).
  • TwilioSmsProvider — provider nativo para a API REST do Twilio usando HTTP básico.

Extensão

Implemente ISmsProvider e registre-o no IocManager para adicionar novos gateways:

public class MyProvider : ISmsProvider
{
    public string Name => "MyProvider";

    public async Task<SmsSendResult> SendAsync(SmsMessage message, CancellationToken cancellationToken)
    {
        // implementação
    }
}

Testes

Execute os testes do módulo com:

dotnet test test/Eaf.Notifications.Sms.Tests --configuration Release
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Eaf.Notifications.Sms:

Package Downloads
Eaf.Middleware.Web.Core

Enterprise Application Foundation - Module Middleware - WebCore Classes

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.4.6 107 8/18/2026