Descripción General
Los endpoints de Mensajes de Prueba permiten enviar diferentes tipos de mensajes a través de Telegram para verificar la integración y probar el sistema de notificaciones. Estos endpoints son útiles para validar la configuración y el funcionamiento del servicio.
🎯 Tipos de Mensajes Disponibles
- Mensajes Informativos: Notificaciones generales y de estado
- Mensajes de Error: Alertas de errores y problemas
- Mensajes de Éxito: Confirmaciones de operaciones exitosas
- Formato Específico: Cada tipo tiene su propio formato y estilo
- Modo Producción: Solo funcionan en modo producción (no DEBUG)
Endpoints Disponibles
POST
/api/telegram/test-info
Envía un mensaje informativo de prueba. Este endpoint permite enviar mensajes informativos para verificar la integración con Telegram.
Body (JSON):
"This is a test info message from RestMaster API"
200 OK - Mensaje Enviado
Mensaje informativo enviado exitosamente
{
"success": true,
"message": "Info message sent successfully",
"timestamp": "2024-01-15T10:30:00Z"
}
400 Bad Request - Error de Envío
Error al enviar el mensaje informativo
{
"success": false,
"message": "Failed to send info message",
"timestamp": "2024-01-15T10:30:00Z"
}
POST
/api/telegram/test-error
Envía un mensaje de error de prueba. Este endpoint permite enviar mensajes de error para verificar las notificaciones de alerta.
Body (JSON):
"This is a test error message from RestMaster API"
200 OK - Mensaje Enviado
Mensaje de error enviado exitosamente
{
"success": true,
"message": "Error message sent successfully",
"timestamp": "2024-01-15T10:30:00Z"
}
400 Bad Request - Error de Envío
Error al enviar el mensaje de error
{
"success": false,
"message": "Failed to send error message",
"timestamp": "2024-01-15T10:30:00Z"
}
POST
/api/telegram/test-success
Envía un mensaje de éxito de prueba. Este endpoint permite enviar mensajes de éxito para verificar las notificaciones de confirmación.
Body (JSON):
"This is a test success message from RestMaster API"
200 OK - Mensaje Enviado
Mensaje de éxito enviado exitosamente
{
"success": true,
"message": "Success message sent successfully",
"timestamp": "2024-01-15T10:30:00Z"
}
400 Bad Request - Error de Envío
Error al enviar el mensaje de éxito
{
"success": false,
"message": "Failed to send success message",
"timestamp": "2024-01-15T10:30:00Z"
}
Ejemplos de Uso
🔧 Ejemplo con curl - Mensaje Informativo
curl -X POST \
'http://localhost:1379/api/telegram/test-info' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '"This is a test info message from RestMaster API"'
🔧 Ejemplo con curl - Mensaje de Error
curl -X POST \
'http://localhost:1379/api/telegram/test-error' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '"This is a test error message from RestMaster API"'
🔧 Ejemplo con curl - Mensaje de Éxito
curl -X POST \
'http://localhost:1379/api/telegram/test-success' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '"This is a test success message from RestMaster API"'
🔧 Ejemplo con JavaScript
// Mensaje informativo
fetch('/api/telegram/test-info', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify('Test info message')
})
.then(response => response.json())
.then(data => console.log(data));
// Mensaje de error
fetch('/api/telegram/test-error', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify('Test error message')
})
.then(response => response.json())
.then(data => console.log(data));
// Mensaje de éxito
fetch('/api/telegram/test-success', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify('Test success message')
})
.then(response => response.json())
.then(data => console.log(data));