n8n-nodes-coze
Version:
n8n node for Coze(扣子), supporting AI chat, workflow automation, file processing, and text-to-speech.
43 lines • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeWorkflow = executeWorkflow;
async function executeWorkflow(i) {
const operation = this.getNodeParameter('operation', i);
const authentication = this.getNodeParameter('authentication', i);
if (operation === 'run') {
const credentials = await this.getCredentials(authentication);
const workflowId = this.getNodeParameter('workflowId', i);
const body = {
workflow_id: workflowId,
};
const parameters = this.getNodeParameter('parameters', i, {});
if (Object.keys(parameters).length > 0) {
body.parameters = parameters;
}
const botId = this.getNodeParameter('botId', i);
if (botId) {
body.bot_id = botId;
}
const ext = this.getNodeParameter('ext', i, {});
if (Object.keys(ext).length > 0) {
body.ext = ext;
}
const isAsync = this.getNodeParameter('isAsync', i);
if (isAsync) {
body.is_async = isAsync;
}
const appId = this.getNodeParameter('appId', i);
if (appId) {
body.app_id = appId;
}
const options = {
baseURL: credentials.baseUrl,
method: 'POST',
url: `/v1/workflow/run`,
body,
json: true,
};
return this.helpers.requestWithAuthentication.call(this, authentication, options);
}
}
//# sourceMappingURL=workflow.js.map