@milerliu/feishu 0.1.16 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/send.ts +24 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milerliu/feishu",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Feishu/Lark channel plugin",
6
6
  "license": "MIT",
package/src/send.ts CHANGED
@@ -309,19 +309,38 @@ export async function sendCardFeishu(params: SendFeishuCardParams): Promise<Feis
309
309
  }
310
310
 
311
311
  const receiveIdType = resolveReceiveIdType(receiveId);
312
- const content = JSON.stringify(card);
312
+
313
+ // Extract content from card for post message
314
+ const markdownContent = card.elements?.[0]?.content || "";
315
+
316
+ // Build post-type rich text message
317
+ const postContent = {
318
+ zh_cn: {
319
+ title: "AI 回复",
320
+ content: [
321
+ [
322
+ {
323
+ tag: "text",
324
+ text: markdownContent,
325
+ },
326
+ ],
327
+ ],
328
+ },
329
+ };
330
+
331
+ const content = JSON.stringify(postContent);
313
332
 
314
333
  if (replyToMessageId) {
315
334
  const response = await client.im.message.reply({
316
335
  path: { message_id: replyToMessageId },
317
336
  data: {
318
337
  content,
319
- msg_type: "interactive",
338
+ msg_type: "post",
320
339
  },
321
340
  });
322
341
 
323
342
  if (response.code !== 0) {
324
- throw new Error(`Feishu card reply failed: ${response.msg || `code ${response.code}`}`);
343
+ throw new Error(`Feishu post reply failed: ${response.msg || `code ${response.code}`}`);
325
344
  }
326
345
 
327
346
  return {
@@ -335,12 +354,12 @@ export async function sendCardFeishu(params: SendFeishuCardParams): Promise<Feis
335
354
  data: {
336
355
  receive_id: receiveId,
337
356
  content,
338
- msg_type: "interactive",
357
+ msg_type: "post",
339
358
  },
340
359
  });
341
360
 
342
361
  if (response.code !== 0) {
343
- throw new Error(`Feishu card send failed: ${response.msg || `code ${response.code}`}`);
362
+ throw new Error(`Feishu post send failed: ${response.msg || `code ${response.code}`}`);
344
363
  }
345
364
 
346
365
  return {