This commit is contained in:
Lizandro Guarnizo
2026-05-18 23:50:50 -05:00
parent bbe83c79ba
commit 7f309186d6
10 changed files with 73 additions and 22 deletions
+2 -7
View File
@@ -12,8 +12,8 @@ import (
"strings"
"github.com/gofiber/fiber/v2"
"github.com/sujit-baniya/fiber-boilerplate/app"
"github.com/sujit-baniya/fiber-boilerplate/pkg/models"
"github.com/sujit-baniya/fiber-boilerplate/pkg/services"
)
// TelegramIndex renderiza la vista de configuración de Telegram.
@@ -222,12 +222,7 @@ func SetPortalWebhook(c *fiber.Ctx) error {
return c.Status(404).JSON(fiber.Map{"error": "Configuración no encontrada"})
}
// Construir URL base desde la configuración de la app
baseURL := app.Http.Server.Url
if len(baseURL) > 0 && baseURL[len(baseURL)-1] == '/' {
baseURL = baseURL[:len(baseURL)-1]
}
webhookURL := baseURL + "/webhooks/telegram-portal"
webhookURL := services.GetPublicURL() + "/webhooks/telegram-portal"
apiURL := fmt.Sprintf("https://api.telegram.org/bot%s/setWebhook", cfg.BotToken)
payload, _ := json.Marshal(map[string]string{"url": webhookURL})