Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

WhatsApp.Api.Otp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

WhatsApp.Api.Otp

WhatsApp API Otp Package for .NET

Source
nugetNuGet
Version
1.0.1
Version published
Maintainers
1
Created
Source

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.

Hire Us

Contact Email - contact@evotechcraft.com

Free Support

Support mail: support@evotechcraft.com

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.

Issues

If you will face any issues with the usage of this package please raise one so that we can quickly fix it as soon as possible.

Contributing

This is an open-source project under MIT License so anyone is welcome to contribute from typos, to source code to documentation.

Keywords

WhatsAppApiOtp

FAQs

Package last updated on 27 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts