EvolutionAPI.Client 0.0.1-preview.5

This is a prerelease version of EvolutionAPI.Client.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package EvolutionAPI.Client --version 0.0.1-preview.5
                    
NuGet\Install-Package EvolutionAPI.Client -Version 0.0.1-preview.5
                    
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="EvolutionAPI.Client" Version="0.0.1-preview.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EvolutionAPI.Client" Version="0.0.1-preview.5" />
                    
Directory.Packages.props
<PackageReference Include="EvolutionAPI.Client" />
                    
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 EvolutionAPI.Client --version 0.0.1-preview.5
                    
#r "nuget: EvolutionAPI.Client, 0.0.1-preview.5"
                    
#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.
#addin nuget:?package=EvolutionAPI.Client&version=0.0.1-preview.5&prerelease
                    
Install EvolutionAPI.Client as a Cake Addin
#tool nuget:?package=EvolutionAPI.Client&version=0.0.1-preview.5&prerelease
                    
Install EvolutionAPI.Client as a Cake Tool

EvolutionAPI Client

Este repositório fornece um exemplo de como se integrar à EvolutionAPI usando EvolutionAPI.Client.

Requisitos

  • .NET 8 ou superior
  • Pacote EvolutionAPI.Client

Funcionalidades

  • ✅ Gerenciamento de Instância
  • ✅ Gerenciamento de Webhook
  • ✅ Envio de mensagens de texto
  • ✅ Envio de mensagens de mídia por URL (imagem, documento, vídeo e áudio)
  • ✅ Envio de localização
  • ✅ Webhook Response Model

Instalação

Adicione a dependência do cliente EvolutionAPI ao seu projeto:

 dotnet add package EvolutionAPI.Client

Configuração

1. Configuração de dependências

Antes de utilizar a API, registre o serviço na injeção de dependências:

Opção 1
using EvolutionAPI.Client;

var apiUrl = "SUA_URL_API";
var apiKey = "SUA_API_KEY";

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddEvolutionApi(apiUrl, apiKey);

var app = builder.Build();
Opção 2
using EvolutionAPI.Client;

var apiUrl = "SUA_URL_API";
var apiKey = "SUA_API_KEY";

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddEvolutionApi(config =>
{
    config.ApiUrl = apiUrl;
    config.ApiKey = apiKey;
});

var app = builder.Build();

2. Injetando a IEvolutionClient

using EvolutionAPI.Client;

public class HomeController : Controller
{
    private readonly IEvolutionClient client;

    public HomeController(IEvolutionClient client)
    {
        this.client = client;
    }

    [HttpGet]
    public async Task<IActionResult> Index()
    {
        return View();
    }
}

Funcionalidades

Criar uma Instância

using EvolutionAPI.Client.Models.Requests.Instance;

var request = new CreateInstanceRequest()
{
    InstanceName = "TESTE-API",
    //Token = "",
    //Number = "",
    //QRCode = false,
    Integration = IntegrationType.WHATSAPP_BAILEYS
};

var response = await client.Instance.Create(request);

Configurar Webhook

using EvolutionAPI.Client.Models.Requests.Webhook;

var request = new CreateWebhookRequest()
{
    Webhook = new()
    {
        Enabled = true,
        Url = "www.domain.com",
        //Headers = new Dictionary<string, string>()
        //{
        //    { "Autorization", "Bearer TOKEN" },
        //    { "Content-Type", "application/json" }
        //},
        //ByEvents = false,
        //Base64 = false,
        Events = [WebhookEvent.MESSAGES_UPSERT, WebhookEvent.SEND_MESSAGE]
    }
};

var response = await client.Webhook.Create(request, "TESTE-API");

Enviar mensagem Texto

using EvolutionAPI.Client.Models.Requests.Message;

var request = new SendTextRequest()
{
    Number = "5511999999999",
    Text = "Teste de mensagem",
    //Delay = 1000
};

var response = await client.Message.SendText(request, "TESTE-API");

Enviar mensagem Mídia URL

using EvolutionAPI.Client.Models.Requests.Message;

var request = new SendMediaUrlRequest()
{
    Number = "5511999999999",
    MediaType = MediaType.IMAGE,
    //MimeType = "image/png",
    //Caption = "Teste de imagem",
    Media = "https://api.nuget.org/v3-flatcontainer/evolutionapi.client/0.0.1-preview.1/icon",
    //FileName = "imagem.png",
    //Delay = 1000
};

var response = await client.Message.SendMediaUrl(request, "TESTE-API");

Enviar localização

using EvolutionAPI.Client.Models.Requests.Message;

var request = new SendLocationRequest()
{
    Number = "5511999999999",
    //Name = "Curitiba, Paraná, Brasil",
    //Address = "Rua XV de Novembro, Centro, Curitiba - PR, 80020-310",
    Latitude = -25.4284,
    Longitude = -49.2733,
    //Delay = 1000
};

var response = await client.Message.SendLocation(request, "TESTE-API");

Observações

  • Certifique-se de que a Evolution API está acessível.
  • Substitua SUA_URL_API e SUA_API_KEY pelos valores reais.
  • A InstanceName deve ser única para cada cliente.

Suporte

Caso tenha dúvidas ou precise de suporte, consulte a documentação oficial da EvolutionAPI ou entre em contato com o suporte da plataforma.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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

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
0.0.1-preview.6 48 6/7/2025
0.0.1-preview.5 122 5/8/2025
0.0.1-preview.4 171 4/6/2025
0.0.1-preview.3 62 4/5/2025
0.0.1-preview.2 101 3/28/2025
0.0.1-preview.1 309 3/24/2025