Track Evolution identifiers for bridge replies

This commit is contained in:
Tiago
2026-09-29 17:30:03 -03:00
parent 3e9ee4db53
commit 21bbc8d385
3 changed files with 63 additions and 28 deletions
@@ -142,15 +142,17 @@ public final class EvolutionApiClient {
if (mockMode(baseUrl) || webhookUrl == null || webhookUrl.isBlank()) return;
Map<String, Object> headers = new LinkedHashMap<>();
if (webhookSecret != null && !webhookSecret.isBlank()) headers.put("X-Webhook-Secret", webhookSecret);
Map<String, Object> webhook = new LinkedHashMap<>();
webhook.put("enabled", true);
webhook.put("url", webhookUrl);
webhook.put("webhook_by_events", false);
webhook.put("webhook_base64", false);
webhook.put("byEvents", false);
webhook.put("base64", false);
webhook.put("events", java.util.List.of("MESSAGES_UPSERT"));
if (!headers.isEmpty()) webhook.put("headers", headers);
Map<String, Object> payload = new LinkedHashMap<>();
payload.put("enabled", true);
payload.put("url", webhookUrl);
payload.put("webhook_by_events", false);
payload.put("webhook_base64", false);
payload.put("byEvents", false);
payload.put("base64", false);
payload.put("events", java.util.List.of("MESSAGES_UPSERT"));
if (!headers.isEmpty()) payload.put("headers", headers);
payload.put("webhook", webhook);
HttpRequest req = HttpRequest.newBuilder(URI.create(clean(baseUrl) + "/webhook/set/" + instanceName))
.timeout(Duration.ofSeconds(20))
.header("Content-Type", "application/json")