@larksuiteoapi/node-sdk 1.3.0 → 1.4.1

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/README.md CHANGED
@@ -403,7 +403,7 @@ const resule = await dispatcher.invoke(data);
403
403
  server.sendResult(result);
404
404
  ````
405
405
 
406
- #### challenge校验
406
+ #### Challenge check
407
407
  When configuring the event request address, The Open Platform will push a POST request in `application/json` format to the request address. The POST request is used to verify the validity of the configured request address, and the request body will carry a `challenge` field , **The application needs to return the received challenge value to the Open Platform within 1 second**. See: [ Document](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case)
408
408
 
409
409
  The adapter provided by the sdk above encapsulates the verification logic. Set the `autoChallenge` field in the options parameter to true to enable:
@@ -430,19 +430,26 @@ router.post(
430
430
  ```
431
431
 
432
432
  ### [Message Card](https://open.feishu.cn/document/ukTMukTMukTM/uczM3QjL3MzN04yNzcDN)
433
+
433
434
  The processing of the Message Card is also a kind of Event processing. The only difference between the two is that the processor of the Message Card is used to respond to the events generated by the interaction between the user and the Message Card. If the processor has a return value (*the value structure should be in line with the structure defined by [Message Card Structure](https://open.feishu.cn/document/ukTMukTMukTM/uEjNwUjLxYDM14SM2ATN)*), then the return value is used to update the responded message card:
434
435
 
435
436
  ```typescript
436
437
  import http from 'http';
437
438
  import * as lark from '@larksuiteoapi/node-sdk';
439
+ import type { InteractiveCardActionEvent, InteractiveCard } from '@larksuiteoapi/node-sdk';
438
440
 
439
441
  const cardDispatcher = new lark.CardActionHandler(
440
442
  {
441
443
  encryptKey: 'encrypt key',
442
444
  verificationToken: 'verification token'
443
445
  },
444
- async(data) => {
446
+ async (data: InteractiveCardActionEvent) => {
445
447
  console.log(data);
448
+ const newCard: InteractiveCard = {
449
+ // your new interactive card content
450
+ header: {},
451
+ elements: []
452
+ };
446
453
  return newCard;
447
454
  }
448
455
  );
@@ -451,6 +458,7 @@ const server = http.createServer();
451
458
  server.on('request', lark.adaptDefault('/webhook/card', cardDispatcher));
452
459
  server.listen(3000);
453
460
  ````
461
+
454
462
  #### `CardActionHandler` construction parameters
455
463
 
456
464
  | Parameter | Description | Type | Required | Default |
package/README.zh.md CHANGED
@@ -429,19 +429,26 @@ router.post(
429
429
  ```
430
430
 
431
431
  ### [消息卡片](https://open.feishu.cn/document/ukTMukTMukTM/uczM3QjL3MzN04yNzcDN)
432
+
432
433
  对消息卡片的处理亦是对事件处理的一种,两者的不同点仅在于消息卡片的处理器用于响应用户与消息卡片交互所产生的事件,若处理器有返回值(*返回值的数据结构理应为符合[消息卡片结构](https://open.feishu.cn/document/ukTMukTMukTM/uEjNwUjLxYDM14SM2ATN)所定义的结构*),则返回值被用来更新被响应的消息卡片:
433
434
 
434
435
  ```typescript
435
436
  import http from 'http';
436
437
  import * as lark from '@larksuiteoapi/node-sdk';
438
+ import type { InteractiveCardActionEvent, InteractiveCard } from '@larksuiteoapi/node-sdk';
437
439
 
438
440
  const cardDispatcher = new lark.CardActionHandler(
439
441
  {
440
442
  encryptKey: 'encrypt key',
441
443
  verificationToken: 'verification token'
442
444
  },
443
- async (data) => {
445
+ async (data: InteractiveCardActionEvent) => {
444
446
  console.log(data);
447
+ const newCard: InteractiveCard = {
448
+ // your new interactive card content
449
+ header: {},
450
+ elements: []
451
+ };
445
452
  return newCard;
446
453
  }
447
454
  );
@@ -450,6 +457,7 @@ const server = http.createServer();
450
457
  server.on('request', lark.adaptDefault('/webhook/card', cardDispatcher));
451
458
  server.listen(3000);
452
459
  ```
460
+
453
461
  #### `CardActionHandler`构造参数
454
462
 
455
463
  | 参数 | 描述 | 类型 | 必须 | 默认 |