@yaoyuanchao/dingtalk 1.3.7 → 1.3.9

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/card-api.ts +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaoyuanchao/dingtalk",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "type": "module",
5
5
  "description": "DingTalk channel plugin for Clawdbot with Stream Mode support",
6
6
  "license": "MIT",
package/src/card-api.ts CHANGED
@@ -148,9 +148,13 @@ export async function createCardInstance(
148
148
  cardTemplateId: params.cardTemplateId,
149
149
  outTrackId: params.outTrackId,
150
150
  cardData: params.cardData || { cardParamMap: {} },
151
- callbackType: params.callbackType || "STREAM",
152
151
  };
153
152
 
153
+ // Only add callbackType if specified (not needed for basic cards)
154
+ if (params.callbackType) {
155
+ body.callbackType = params.callbackType;
156
+ }
157
+
154
158
  if (params.robotCode) {
155
159
  body.robotCode = params.robotCode;
156
160
  }
@@ -159,13 +163,24 @@ export async function createCardInstance(
159
163
  body.userIdType = params.userIdType;
160
164
  }
161
165
 
166
+ console.log("[dingtalk-card] createCardInstance request:", JSON.stringify(body, null, 2));
167
+
162
168
  const res = await jsonPost(
163
169
  `${DINGTALK_API_BASE}/card/instances`,
164
170
  body,
165
171
  { "x-acs-dingtalk-access-token": token },
166
172
  );
167
173
 
174
+ console.log("[dingtalk-card] createCardInstance response:", JSON.stringify(res, null, 2));
175
+
168
176
  if (res.code || res.errcode) {
177
+ console.warn("[dingtalk-card] Failed to create card instance:", {
178
+ success: false,
179
+ errcode: res.errcode,
180
+ errmsg: res.errmsg,
181
+ code: res.code,
182
+ message: res.message,
183
+ });
169
184
  return {
170
185
  success: false,
171
186
  errcode: res.errcode,
@@ -419,7 +434,7 @@ export async function sendCardMessage(params: {
419
434
  outTrackId,
420
435
  cardData: { cardParamMap: params.cardData },
421
436
  robotCode: params.robotCode,
422
- callbackType: "STREAM",
437
+ // Note: callbackType not needed for basic cards
423
438
  });
424
439
 
425
440
  if (!createResult.success) {