Sparc.Blossom.Realtime.Twilio 7.1.0-pre.1

This is a prerelease version of Sparc.Blossom.Realtime.Twilio.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Sparc.Blossom.Realtime.Twilio --version 7.1.0-pre.1                
NuGet\Install-Package Sparc.Blossom.Realtime.Twilio -Version 7.1.0-pre.1                
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="Sparc.Blossom.Realtime.Twilio" Version="7.1.0-pre.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sparc.Blossom.Realtime.Twilio --version 7.1.0-pre.1                
#r "nuget: Sparc.Blossom.Realtime.Twilio, 7.1.0-pre.1"                
#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.
// Install Sparc.Blossom.Realtime.Twilio as a Cake Addin
#addin nuget:?package=Sparc.Blossom.Realtime.Twilio&version=7.1.0-pre.1&prerelease

// Install Sparc.Blossom.Realtime.Twilio as a Cake Tool
#tool nuget:?package=Sparc.Blossom.Realtime.Twilio&version=7.1.0-pre.1&prerelease                

Sparc.Notifications.Twilio

Nuget

The Sparc.Notifications.Twilio plugin is a plugin that enables low-configuration email and SMS notifications in your application, using Twilio as the provider.

Get Started with Sparc.Notifications.Twilio

In Your Features Project:

  1. Add the Sparc.Notifications.Twilio Nuget package: Nuget

  2. Add the following settings to your appsettings.json file:

     {
        "Twilio": {
            "AccountSid": "", // the SID from your Twilio account
            "AuthToken": "", // the secret Auth Token from your Twilio account (preferably store this in usersecrets.json)
            "FromPhoneNumber": "+1555121212", // the configured Twilio Phone Number to send SMSs
            "FromEmailAddress": "info@myapp.com", // the email address all emails will come from
            "FromName": "My App", // the From name for all outbound emails
            "SendGridApiKey": "", // the SendGrid API key from your Twilio / Sendgrid account
    }
    
  3. Add the following line of code to your Startup.cs file to register the Sparc.Notifications.Twilio plugin. It will automatically read the configuration from the Twilio section of your appsettings.json file.

    services.AddTwilio(Configuration);
    
  4. Inject TwilioService into any feature that needs to send emails or SMS messages. For example:

    public class SendRegistrationNotification : Feature<bool>
    {
        IRepository<User> Users { get; set; }
        TwilioService Twilio { get; set; }
    
        public SendRegistrationNotification(IRepository<User> users, TwilioService twilio)
        {
            Users = users;
            Twilio = twilio;
        }
    
        public override async Task<bool> ExecuteAsync()
        {
            var user = await Users.FindAsync(User.Id());
            var message = "You have successfully registered!";
    
            if (user.PhoneNumber != null)
                await Twilio.SendSmsAsync(user.PhoneNumber, message);
            else 
                await Twilio.SendEmailAsync(user.Email, message);
    
           // or simply call Twilio.SendAsync and pass in either an email or phone number, and the plugin will send an SMS or email accordingly
           await Twilio.SendAsync(user.PhoneNumber ?? user.Email, message);
    
           return true;
        }
    }
    
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.1.0 174 5/10/2023
7.1.0-pre.1 167 12/13/2022