web-chat-public
Endpoints públicos consumidos por el widget JS desde el navegador del visitante.
/web-chat/:token·6 endpoints·Source: mosend-wb-backend/src/modules/web-chat/web-chat-public.controller.ts/web-chat/:token/sessionsPúblico (widget): crea sesión del visitante (anónima, identificada o verify-OTP).
Path params
tokenstringrequerido
Body (JSON)
visitorIdstringrequeridomodestringrequeridoanonymousidentifiedverify-otphost-identifiednamestringemailstring · emailphonestringotpstringuserIdstringhashstringHMAC-SHA256 hex de `userId || email`, firmado con `WebChatChannel.identitySecret`.
attributesobjectAtributos custom del host (plan, role, etc.) — van a visitor.metadata.host.
departmentIdstringprechatobjectRespuestas del prechat dinámico: { fieldId: value }.
urlstringDatos del navegador / contexto.
refererstringtitlestringlangstringutmobject
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/web-chat/<token>/sessions' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"visitorId": "00000000-0000-0000-0000-000000000000","mode": "anonymous","name": "<name>","email": "persona@empresa.com","phone": "<phone>","otp": "<otp>","userId": "00000000-0000-0000-0000-000000000000","hash": "<hash>","attributes": {},"departmentId": "00000000-0000-0000-0000-000000000000","prechat": {},"url": "https://tu-app.com/endpoint","referer": "<referer>","title": "<title>","lang": "<lang>","utm": {}}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/web-chat/:token/sessions/resend-otpPúblico (widget): reenvía el código OTP de verificación por email.
Path params
tokenstringrequerido
Body (JSON)
emailstring · emailrequerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/web-chat/<token>/sessions/resend-otp' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"email": "persona@empresa.com"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/web-chat/:token/historyPúblico (widget): historial reciente del visitante (requiere visitor JWT).
Path params
tokenstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/web-chat/<token>/history' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/web-chat/:token/sessions/link-emailPúblico (widget): vincula un email al visitante (requiere visitor JWT).
Path params
tokenstringrequerido
Body (JSON)
emailstring · emailrequeridonamestring
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/web-chat/<token>/sessions/link-email' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"email": "persona@empresa.com","name": "<name>"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/web-chat/:token/uploadPúblico (widget): sube un adjunto y devuelve su mediaAssetId (requiere visitor JWT).
Path params
tokenstringrequerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/web-chat/<token>/upload' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/web-chat/:token/messagesPúblico (widget): envía un mensaje con adjunto del visitante (requiere visitor JWT).
Path params
tokenstringrequerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/web-chat/<token>/messages' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}