separated in modules

This commit is contained in:
Lucas Tettamanti
2026-01-15 22:45:33 -03:00
parent eedd16afdb
commit ea62385e3d
41 changed files with 1116 additions and 2918 deletions

View File

@@ -0,0 +1,30 @@
import crypto from "crypto";
import { resolveTenantId } from "../../2-identity/services/pipeline.js";
import { processMessage } from "../../2-identity/services/pipeline.js";
export async function handleSimSend(body) {
const { chat_id, from_phone, text } = body || {};
if (!chat_id || !from_phone || !text) {
return { status: 400, payload: { ok: false, error: "chat_id, from_phone, text are required" } };
}
const provider = "sim";
const message_id = crypto.randomUUID();
const tenantId = await resolveTenantId({
chat_id,
tenant_key: body?.tenant_key,
to_phone: body?.to_phone,
});
const result = await processMessage({
tenantId,
chat_id,
from: from_phone,
text,
provider,
message_id,
});
return { status: 200, payload: { ok: true, run_id: result.run_id, reply: result.reply } };
}