@yaoyuanchao/dingtalk 1.3.11 → 1.3.13
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.
- package/package.json +1 -1
- package/src/card-api.ts +5 -2
- package/src/monitor.ts +4 -7
package/package.json
CHANGED
package/src/card-api.ts
CHANGED
|
@@ -144,10 +144,12 @@ export async function createCardInstance(
|
|
|
144
144
|
try {
|
|
145
145
|
const token = await getDingTalkAccessToken(params.clientId, params.clientSecret);
|
|
146
146
|
|
|
147
|
+
// Note: cardData must be a JSON string, not an object!
|
|
148
|
+
const cardDataObj = params.cardData || { cardParamMap: {} };
|
|
147
149
|
const body: Record<string, any> = {
|
|
148
150
|
cardTemplateId: params.cardTemplateId,
|
|
149
151
|
outTrackId: params.outTrackId,
|
|
150
|
-
cardData:
|
|
152
|
+
cardData: JSON.stringify(cardDataObj),
|
|
151
153
|
};
|
|
152
154
|
|
|
153
155
|
// Only add callbackType if specified (not needed for basic cards)
|
|
@@ -298,9 +300,10 @@ export async function updateCard(
|
|
|
298
300
|
try {
|
|
299
301
|
const token = await getDingTalkAccessToken(params.clientId, params.clientSecret);
|
|
300
302
|
|
|
303
|
+
// Note: cardData must be a JSON string, not an object!
|
|
301
304
|
const body: Record<string, any> = {
|
|
302
305
|
outTrackId: params.outTrackId,
|
|
303
|
-
cardData: params.cardData,
|
|
306
|
+
cardData: JSON.stringify(params.cardData),
|
|
304
307
|
};
|
|
305
308
|
|
|
306
309
|
if (params.userIdType !== undefined) {
|
package/src/monitor.ts
CHANGED
|
@@ -771,12 +771,14 @@ async function deliverCardReply(
|
|
|
771
771
|
const robotCodeValue = robotCode || clientId;
|
|
772
772
|
|
|
773
773
|
// Prepare card data - use configurable key for content variable (default: 'content')
|
|
774
|
-
// For basic cards:
|
|
775
|
-
// For AI streaming cards: also send 'flowStatus'
|
|
774
|
+
// For basic cards: send content and title
|
|
775
|
+
// For AI streaming cards: also send 'flowStatus'
|
|
776
776
|
const isStreaming = cardConfig.streamingEnabled;
|
|
777
777
|
const contentKey = cardConfig.streamingKey || 'content';
|
|
778
778
|
const cardData: Record<string, string> = {
|
|
779
779
|
[contentKey]: text,
|
|
780
|
+
// Always send title - required by templates with title variable
|
|
781
|
+
title: cardConfig.title || "",
|
|
780
782
|
};
|
|
781
783
|
|
|
782
784
|
// Only add flowStatus for streaming cards (AI cards)
|
|
@@ -784,11 +786,6 @@ async function deliverCardReply(
|
|
|
784
786
|
cardData.flowStatus = "0"; // "0" = streaming in progress
|
|
785
787
|
}
|
|
786
788
|
|
|
787
|
-
// Only add title if explicitly configured
|
|
788
|
-
if (cardConfig.title) {
|
|
789
|
-
cardData.title = cardConfig.title;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
789
|
log?.info?.("[dingtalk-card] Sending card message, templateId=" + cardConfig.templateId + ", contentKey=" + contentKey);
|
|
793
790
|
|
|
794
791
|
const result = await sendCardMessage({
|