-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbatchAPIReqCall.js
36 lines (29 loc) · 1.07 KB
/
batchAPIReqCall.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const lark = require("@larksuiteoapi/allcore");
const appSettings = lark.getInternalAppSettingsByEnv()
const conf = lark.newConfig(lark.Domain.FeiShu, appSettings, {
loggerLevel: lark.LoggerLevel.ERROR,
})
let reqCall1 = new lark.api.APIReqCall(conf, lark.api.newRequest("/open-apis/message/v4/send", "POST", lark.api.AccessTokenType.Tenant, {
"user_id": "77bbc392",
msg_type: "text",
content: {
text: "test"
}
}));
let reqCall2 = new lark.api.APIReqCall(conf, lark.api.newRequest("/open-apis/message/v4/send", "POST", lark.api.AccessTokenType.Tenant, {
"user_id": "77bbc392",
msg_type: "text",
content: {
text: "test2"
}
}));
let batchReqCall = new lark.api.BatchAPIReqCall(reqCall1, reqCall2);
batchReqCall.do().then(function (batchReqCall) {
for (let result of batchReqCall.reqCallResults) {
console.log("--------------------------")
console.log(result.response.getRequestID())
console.log(result.response.getHTTPStatusCode())
console.log(result.response)
//console.log(done.err)
}
})