WhatsApp.Api.Otp 1.0.0

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

// Install WhatsApp.Api.Otp as a Cake Tool
#tool nuget:?package=WhatsApp.Api.Otp&version=1.0.0                

WhatsApp API OTP

A free and open source .NET NuGet package to facilitate sending OTP messages through WhatsApp Business APIs. This package provides a simple and efficient way to deliver OTP messages, ensuring they reach your users swiftly and securely.

Features

  • Easy integration with WhatsApp Business APIs.
  • Send OTP messages with minimal setup.
  • Secure and reliable delivery.
  • Lightweight and efficient.

Sample .NET Api project using this nuget package

WhatsApp Api Otp Demo Git Repository - https://github.com/evotechcraft/WhatsApp.Api.Demo

Installation

To install the package, use the NuGet Package Manager Console: Install-Package WhatsApp.Api.Otp

Or use the .NET CLI: dotnet add package WhatsApp.Api.Otp

Usage

Here's a basic example of how to use the WhatsApp.Api.Otp in your project:

using Microsoft.AspNetCore.Mvc;
using WhatsApp.Api.Otp.Common.Request;
using WhatsApp.Api.Otp.Contracts;

namespace whatsapp_otp_api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class WhatsappMessageController : ControllerBase
    {
        private IWAOtpService _wAOtp;

        public WhatsappMessageController(IWAOtpService wAOtp)
        {
            _wAOtp = wAOtp;
        }

        [HttpPost("SendOtpMessage")]
        public async Task<IActionResult> SendOtpMessage(OtpMessageModel message)
        {
            var response = await _wAOtp.SendOtpMessageAsync(message);

            if (!response.IsSuccess)
            {
                return BadRequest(response);
            }
            return Ok(response);
        }
    }
}

Appsettings:

"WhatsAppConfigurations": {
  "ApiUrl": "https://graph.facebook.com",
  "PhoneNumberId": "{{PhoneNumberId}}",
  "AccessToken": "{{AccessToken}}",
  "Version": "v20.0"
}

Replace placeholders like "{{PhoneNumberId}}" and "{{AccessToken}}" with the appropriate details as necessary.

Adds WhatsApp.Api.Otp dependencies to the service collection.

/// <summary>
/// Adds WhatsApp.Api.Otp dependencies to the service collection.
/// </summary>
/// <param name="service">The service collection.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="configSectionName">The name of the configuration section (optional).</param>

builder.Services.AddWAApiDependency(builder.Configuration, "WhatsAppConfigurations");

Request class

public class OtpMessageModel
{
    public string TemplateName { get; set; }
    public string RecipientNumber { get; set; }
    public string Otp { get; set; }
    public ETemplateLanguage Language { get; set; }
}

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Support

contact mail: sales@evotechcraft.com.

Changelog

Make sure to check the CHANGELOG for any updates or changes.


I made minor adjustments to clarify instructions, improved readability, and formatted code examples for consistency. Let me know if you need further refinement!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.1 96 10/27/2024
1.0.0 114 10/13/2024