n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
42 lines • 1.74 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const form_data_1 = __importDefault(require("form-data"));
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.UploadImage,
value: "uploadImage",
order: 193,
options: [
description_1.DESCRIPTIONS.BINARY_PROPERTY_NAME,
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/im-v1/image/create">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', index);
const binaryData = this.helpers.assertBinaryData(index, binaryPropertyName);
const dataBuffer = await this.helpers.getBinaryDataBuffer(index, binaryPropertyName);
const formData = new form_data_1.default();
formData.append('image_type', 'message');
formData.append('image', dataBuffer, {
filename: binaryData.fileName,
contentType: binaryData.mimeType,
});
const { data } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: `/open-apis/im/v1/images`,
body: formData,
json: true,
});
return data;
},
};
//# sourceMappingURL=ImageUpload.operation.js.map