Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Console/Interactive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Task StartAsync(CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(service))
{
service = AnsiConsole.Ask("Enter WhatsApp functions endpoint", "http://localhost:4242/whatsappcli");
service = AnsiConsole.Ask("Enter WhatsApp functions endpoint", "http://localhost:4242/whatsapp/cli");
Config.Build(ConfigLevel.Global)
.SetString("whatsapp", "endpoint", service);
}
Expand Down
8 changes: 5 additions & 3 deletions src/WhatsApp/AzureFunctionsConsole.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Text;
using System.Text.Json;
using System.Xml;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
Expand All @@ -25,10 +24,13 @@ class AzureFunctionsConsole(
WriteIndented = true
};

[Function("whatsapp_console_legacy")]
public IActionResult MessageConsoleLegacy([HttpTrigger(AuthorizationLevel.Anonymous, ["post", "get"], Route = "whatsappcli")] HttpRequest req)
=> new RedirectResult(req.Path.Value.Replace("whatsappcli", "whatsapp/cli"), true, true);

[Function("whatsapp_console")]
public async Task<IActionResult> MessageConsole([HttpTrigger(AuthorizationLevel.Anonymous, ["post", "get"], Route = "whatsappcli")] HttpRequest req)
public async Task<IActionResult> MessageConsole([HttpTrigger(AuthorizationLevel.Anonymous, ["post", "get"], Route = "whatsapp/cli")] HttpRequest req)
{

// This endpoint is only available in development environments, since it allows sending messages from the debug console.
if (environment.IsProduction())
return new UnauthorizedResult();
Expand Down
4 changes: 2 additions & 2 deletions src/WhatsApp/AzureFunctionsProcessors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task<IActionResult> HandleEventGrid(
#if CI || RELEASE
[EventGridTrigger] EventGridEvent e)
#else
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "whatsapp/eventgrid")]
[Microsoft.Azure.Functions.Worker.Http.FromBody] EventGridEvent e)
#endif
{
Expand All @@ -31,7 +31,7 @@ public async Task<IActionResult> HandleEventGrid(

[Function("whatsapp_process")]
public async Task<IActionResult> ProcessAsync(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req)
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "whatsapp/process")] HttpRequest req)
{
if (string.IsNullOrEmpty(options.Secret) ||
!req.Headers.TryGetValue("X-WHATSAPP-SECRET", out var values) ||
Expand Down