1) Endpoint
POST /api/simulate-incoming acepta text,image,video,audio,document,sticker,location,contact. Persistirá el mensaje en tu BD, disparará el webhook (si está configurado) y lo emitirá por SSE.
POST /api/simulate-incoming
Content-Type: application/json
{
"instanceId": 123,
"token": "TOKEN",
"from": "573001112233",
"to": "573009998877",
"type": "text",
"body": "Hola! ¿Horario hoy?"
}
Media
{
"instanceId": 123,
"token": "TOKEN",
"from": "573001112233",
"to": "573009998877",
"type": "image",
"media_url": "https://mi-cdn.com/foto.jpg",
"body": "Foto del producto"
}
Ubicación
{
"instanceId": 123,
"token": "TOKEN",
"from": "573001112233",
"to": "573009998877",
"type": "location",
"latitude": 4.7110,
"longitude": -74.0721
}
En grupos, usa JIDs ...@g.us en from/to.