n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
78 lines • 2.87 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
const wording_1 = require("../../../help/wording");
const description_1 = require("../../../help/description");
exports.default = {
name: wording_1.WORDING.SendMessageCard,
value: "sendMessageCard",
order: 182,
options: [
{
displayName: `Only work with Tenant Access Token`,
name: 'notice',
type: 'notice',
default: '',
},
description_1.DESCRIPTIONS.CHAT_ID,
{
displayName: 'User ID Type(用户 ID 类型)',
name: 'user_id_type',
type: 'options',
options: [
{ name: 'Open ID', value: 'open_id' },
{ name: 'User ID', value: 'user_id' },
{ name: 'Email', value: 'email' },
],
default: 'open_id',
},
{
displayName: 'ID',
name: 'id',
type: 'string',
required: true,
default: '',
},
{
displayName: 'Message Card(消息卡片)',
name: 'message_card',
type: 'json',
default: '',
required: true,
},
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/im-v1/message-card/send-message-cards-that-are-only-visible-to-certain-people">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const chat_id = this.getNodeParameter('chat_id', index);
const user_id_type = this.getNodeParameter('user_id_type', index);
const id = this.getNodeParameter('id', index, '');
const message_card = this.getNodeParameter('message_card', index, undefined, {
ensureType: 'json',
});
const openId = user_id_type === 'open_id' ? id : undefined;
const userId = user_id_type === 'user_id' ? id : undefined;
const email = user_id_type === 'email' ? id : undefined;
const { data } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: `/open-apis/ephemeral/v1/send`,
body: {
chat_id,
...(openId && { open_id: openId }),
...(userId && { user_id: userId }),
...(email && { email }),
msg_type: 'interactive',
card: message_card,
},
});
return data;
},
};
//# sourceMappingURL=CardSend.operation.js.map