n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
61 lines • 2.62 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 GenericFunctions_1 = require("../../GenericFunctions");
exports.default = {
name: wording_1.WORDING.SendAndWaitMessage,
value: n8n_workflow_1.SEND_AND_WAIT_OPERATION,
action: 'Send message and wait for response',
order: 100,
options: [
{
displayName: `Only work with <a target="_blank" href="https://open.feishu.cn/document/server-docs/authentication-management/access-token/tenant_access_token_internal">Tenant Token.</a>`,
name: 'notice',
type: 'notice',
default: '',
},
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 messageIdSaveKey = options.messageIdSaveKey || 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, GenericFunctions_1.createSendAndWaitMessageBody)(this),
...(uuid && { uuid }),
},
});
if (messageIdSaveKey) {
this.getWorkflowDataProxy(0).$execution.customData.set(messageIdSaveKey, message_id);
}
const waitTill = (0, GenericFunctions_1.configureWaitTillDate)(this);
await this.putExecutionToWait(waitTill);
return this.getInputData();
},
};
//# sourceMappingURL=SendAndWait.operation.js.map