n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
57 lines • 2.36 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const n8n_workflow_1 = require("n8n-workflow");
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
const wording_1 = require("../../../help/wording");
const description_1 = require("../../../help/description");
const properties_1 = require("../../../help/utils/properties");
const webhook_1 = require("../../../help/utils/webhook");
const cache_1 = require("../../../lark-sdk/handler/cache");
exports.default = {
name: wording_1.WORDING.SendAndWaitMessage,
value: n8n_workflow_1.SEND_AND_WAIT_OPERATION,
action: 'Send message and wait',
order: 1,
options: [
description_1.DESCRIPTIONS.RECEIVE_ID_TYPE,
{
...description_1.DESCRIPTIONS.MEMBER_ID,
displayName: 'Receive ID(接收 ID)',
name: 'receive_id',
},
...properties_1.sendAndWaitProperties,
],
async call(index) {
const receive_id_type = this.getNodeParameter('receive_id_type', index, 'open_id');
const receive_id = this.getNodeParameter('receive_id', index, undefined, {
extractValue: true,
});
const options = this.getNodeParameter('options', index, {});
const uuid = options.request_id || undefined;
const { data: { message_id }, } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: `/open-apis/im/v1/messages`,
qs: {
receive_id_type,
},
body: {
receive_id,
msg_type: 'interactive',
content: (0, webhook_1.createSendAndWaitMessageBody)(this),
...(uuid && { uuid }),
},
});
const waitTill = (0, webhook_1.configureWaitTillDate)(this);
if (message_id) {
cache_1.internalCache.set('sendAndWaitMessageId', message_id, waitTill.getTime(), {
namespace: `${this.getWorkflow().id}-${this.getExecutionId()}`,
});
}
await this.putExecutionToWait(waitTill);
return this.getInputData();
},
};
//# sourceMappingURL=SendAndWait.operation.js.map