diff --git a/src/main/java/com/seconectai/condocontab/integracao/EvolutionApiClient.java b/src/main/java/com/seconectai/condocontab/integracao/EvolutionApiClient.java index c73f1b7..696860c 100644 --- a/src/main/java/com/seconectai/condocontab/integracao/EvolutionApiClient.java +++ b/src/main/java/com/seconectai/condocontab/integracao/EvolutionApiClient.java @@ -142,17 +142,15 @@ public final class EvolutionApiClient { if (mockMode(baseUrl) || webhookUrl == null || webhookUrl.isBlank()) return; Map headers = new LinkedHashMap<>(); if (webhookSecret != null && !webhookSecret.isBlank()) headers.put("X-Webhook-Secret", webhookSecret); - Map 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 payload = new LinkedHashMap<>(); - payload.put("webhook", webhook); + 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); HttpRequest req = HttpRequest.newBuilder(URI.create(clean(baseUrl) + "/webhook/set/" + instanceName)) .timeout(Duration.ofSeconds(20)) .header("Content-Type", "application/json")