MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / smokeSdkClientMessageCreate

Function smokeSdkClientMessageCreate

scripts/feishu/smoke.ts:522–590  ·  view source on GitHub ↗
(input: {
  live: boolean;
  env: SmokeEnv;
})

Source from the content-addressed store, hash-verified

520}
521
522async function smokeSdkClientMessageCreate(input: {
523 live: boolean;
524 env: SmokeEnv;
525}): Promise<SmokeStep> {
526 const lark = loadLarkSdk();
527 if (typeof lark.Client !== "function") {
528 return {
529 name: "SDK Client import",
530 status: "fail",
531 detail: "@larksuiteoapi/node-sdk Client export is unavailable.",
532 };
533 }
534 if (!input.live) {
535 new lark.Client({
536 appId: "cli_smoke_app",
537 appSecret: "smoke-secret",
538 loggerLevel: lark.LoggerLevel.warn,
539 });
540 return {
541 name: "Client im.message.create",
542 status: "pass",
543 detail: "dry-run: SDK Client constructed and message.create payload shape is ready.",
544 request: buildImMessageCreateRequest(input.env.chatId ?? "oc_smoke_chat"),
545 liveCheck: true,
546 requiredEnv: ["FEISHU_APP_ID", "FEISHU_APP_SECRET", "FEISHU_SMOKE_CHAT_ID"],
547 };
548 }
549 if (!input.env.appId || !input.env.appSecret || !input.env.chatId) {
550 return {
551 name: "Client im.message.create",
552 status: "skip",
553 detail: formatMissingEnvDetail([
554 "FEISHU_APP_ID",
555 "FEISHU_APP_SECRET",
556 "FEISHU_SMOKE_CHAT_ID",
557 ], "send a live bot message"),
558 liveCheck: true,
559 requiredEnv: ["FEISHU_APP_ID", "FEISHU_APP_SECRET", "FEISHU_SMOKE_CHAT_ID"],
560 };
561 }
562
563 const client = new lark.Client({
564 appId: input.env.appId,
565 appSecret: input.env.appSecret,
566 ...(input.env.apiBaseUrl ? { domain: input.env.apiBaseUrl } : {}),
567 loggerLevel: lark.LoggerLevel.warn,
568 });
569 const response = await client.im.message.create({
570 params: {
571 receive_id_type: "chat_id",
572 },
573 data: {
574 receive_id: input.env.chatId,
575 msg_type: "text",
576 content: JSON.stringify({
577 text: `AgentSpace Feishu smoke ${new Date().toISOString()}`,
578 }),
579 uuid: `agentspace-smoke-${Date.now()}`,

Callers 1

mainFunction · 0.85

Calls 6

loadLarkSdkFunction · 0.85
formatMissingEnvDetailFunction · 0.85
readFeishuApiOkFunction · 0.85
summarizeResponseFunction · 0.85
nowMethod · 0.65

Tested by

no test coverage detected