refactor chat delivery to graphql + hatchet services

This commit is contained in:
Ruslan Bakiev
2026-03-08 18:55:58 +07:00
parent fe4bd59248
commit 7d1bed0d67
61 changed files with 5007 additions and 5004 deletions

View File

@@ -0,0 +1,3 @@
import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
export const hatchet = HatchetClient.init();

View File

@@ -0,0 +1,31 @@
import { hatchet } from "./client";
import type { OmniInboundEnvelopeV1 } from "../types";
export type TelegramOutboundTaskInput = {
omniMessageId: string;
chatId: string;
text: string;
businessConnectionId?: string | null;
};
const processTelegramInbound = hatchet.task({
name: "process-telegram-inbound",
});
const processTelegramOutbound = hatchet.task({
name: "process-telegram-outbound",
});
export async function enqueueTelegramInboundTask(input: OmniInboundEnvelopeV1) {
const run = await processTelegramInbound.runNoWait(input as any);
return {
runId: await run.runId,
};
}
export async function enqueueTelegramOutboundTask(input: TelegramOutboundTaskInput) {
const run = await processTelegramOutbound.runNoWait(input as any);
return {
runId: await run.runId,
};
}