@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
424 lines • 12.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.openLinesImConnectorFields = exports.openLinesBotFields = exports.openLinesNetworkFields = exports.openLinesStatisticsFields = exports.openLinesDialogFields = exports.openLinesConfigFields = exports.openLinesConnectorFields = exports.openLinesOptions = exports.openLinesOptionsFields = exports.openLinesListFields = exports.openLinesMessageFields = exports.openLinesSessionFields = exports.openLinesOperationFields = void 0;
const ModuleManager_1 = require("../ModuleManager");
// OpenLines operations
const operationField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Operation",
name: "operation",
type: "options",
noDataExpression: true,
options: [
{
name: "Send Message",
value: "sendMessage",
description: "Send a message",
action: "Send a message",
},
{
name: "Get Messages",
value: "getMessages",
description: "Get messages",
action: "Get messages",
},
{
name: "Create Session",
value: "createSession",
description: "Create a new session",
action: "Create a new session",
},
{
name: "Close Session",
value: "closeSession",
description: "Close a session",
action: "Close a session",
},
{
name: "Get Sessions",
value: "getSessions",
description: "Get sessions",
action: "Get sessions",
},
],
default: "getSessions",
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES);
// Session ID field
const sessionIdField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Session ID",
name: "sessionId",
type: "string",
required: true,
default: "",
description: "ID of the session",
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {
operation: ["sendMessage", "closeSession"],
});
// Message field
const messageField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Message",
name: "message",
type: "string",
required: true,
default: "",
description: "Message content",
typeOptions: {
rows: 4,
},
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {
operation: ["sendMessage"],
});
// Configuration ID field
const configIdField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Configuration ID",
name: "configId",
type: "string",
required: true,
default: "",
description: "OpenLines configuration ID",
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {
operation: ["createSession"],
});
// User ID field
const userIdField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "User ID",
name: "userId",
type: "string",
default: "",
description: "User ID for the session",
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {
operation: ["createSession"],
});
// Return All field
const returnAllField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Return All",
name: "returnAll",
type: "boolean",
default: false,
description: "Whether to return all results or only up to the limit",
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {
operation: ["getMessages", "getSessions"],
});
// Limit field
const limitField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Limit",
name: "limit",
type: "number",
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 50,
description: "Max number of results to return",
}, ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {
operation: ["getMessages", "getSessions"],
returnAll: [false],
});
// Options collection
const optionsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Options", ModuleManager_1.BITRIX24_MODULES.OPEN_LINES, {}, [
{
displayName: "Access Token",
name: "accessToken",
type: "string",
default: "",
description: "Access token for authentication",
},
{
displayName: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter criteria",
},
{
displayName: "Sort",
name: "sort",
type: "json",
default: "{}",
description: "Sort order for results",
},
]);
exports.openLinesOperationFields = [operationField];
exports.openLinesSessionFields = [
sessionIdField,
configIdField,
userIdField,
];
exports.openLinesMessageFields = [messageField];
exports.openLinesListFields = [
returnAllField,
limitField,
];
exports.openLinesOptionsFields = [optionsCollection];
// Alias for backward compatibility
exports.openLinesOptions = exports.openLinesOptionsFields;
exports.openLinesConnectorFields = [
// Fields for connector operations
{
displayName: "Connector ID",
name: "connectorId",
type: "string",
displayOptions: {
show: {
operation: ["getConnector"],
},
},
default: "",
description: "The ID of the connector",
},
];
exports.openLinesConfigFields = [
// Fields for config operations
{
displayName: "Config ID",
name: "configId",
type: "string",
displayOptions: {
show: {
operation: ["getConfig", "updateConfig"],
},
},
default: "",
description: "The ID of the configuration",
},
{
displayName: "Fields",
name: "fields",
type: "json",
displayOptions: {
show: {
operation: ["updateConfig"],
},
},
default: "{}",
description: "Fields to update in the configuration",
},
];
exports.openLinesDialogFields = [
// Fields for dialog operations
{
displayName: "Message",
name: "message",
type: "string",
displayOptions: {
show: {
operation: [
"answerSession",
"addNetworkMessage",
"updateNetworkMessage",
],
},
},
default: "",
description: "The message to send",
},
];
exports.openLinesStatisticsFields = [
// Fields for statistics operations
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
options: [
{
displayName: "Date From",
name: "dateFrom",
type: "dateTime",
default: "",
description: "Start date for the statistics period",
},
{
displayName: "Date To",
name: "dateTo",
type: "dateTime",
default: "",
description: "End date for the statistics period",
},
],
},
];
exports.openLinesNetworkFields = [
// Fields for network operations
{
displayName: "Network Code",
name: "networkCode",
type: "string",
displayOptions: {
show: {
operation: [
"joinNetwork",
"addNetworkMessage",
"updateNetworkMessage",
"deleteNetworkMessage",
],
},
},
default: "",
description: "The code of the network to join",
},
{
displayName: "Chat",
name: "chat",
type: "string",
displayOptions: {
show: {
operation: ["addNetworkMessage"],
},
},
default: "",
description: "The chat identifier",
},
{
displayName: "Message ID",
name: "messageId",
type: "string",
displayOptions: {
show: {
operation: ["updateNetworkMessage", "deleteNetworkMessage"],
},
},
default: "",
description: "The ID of the message",
},
];
exports.openLinesBotFields = [
// Fields for bot registration
{
displayName: "Code",
name: "code",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["registerBot"],
},
},
default: "",
description: "Authorization code received in the redirect URL",
},
{
displayName: "Event Handler URL",
name: "eventHandlerUrl",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["registerBot"],
},
},
default: "",
description: "URL where bot events will be sent",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
options: [
{
displayName: "Bot Name",
name: "botName",
type: "string",
default: "",
description: "Name of the bot",
},
{
displayName: "Bot Description",
name: "botDescription",
type: "string",
default: "",
description: "Description of the bot",
},
{
displayName: "Bot Avatar",
name: "botAvatar",
type: "string",
default: "",
description: "URL to the bot avatar image",
},
],
},
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["unregisterBot"],
},
},
default: "",
description: "ID of the bot to unregister",
},
];
exports.openLinesImConnectorFields = [
// Fields for ImConnector operations
{
displayName: "Connector",
name: "connector",
type: "string",
required: true,
displayOptions: {
show: {
operation: [
"getConnectorStatus",
"bindConnector",
"deleteConnector",
"getConnectionInfo",
"getConnectedInfo",
"getConnectorInfo",
"getConnectorData",
],
},
},
default: "",
description: "The connector type (e.g., facebook, telegram, viber)",
},
{
displayName: "Line",
name: "line",
type: "string",
displayOptions: {
show: {
operation: [
"getConnectorStatus",
"bindConnector",
"deleteConnector",
"getConnectionInfo",
"getConnectedInfo",
"getConnectorData",
],
},
},
default: "",
description: "The line ID for the connector",
},
{
displayName: "Registration Fields",
name: "fields",
type: "json",
displayOptions: {
show: {
operation: ["registerConnector"],
},
},
default: "{}",
description: "Fields required for connector registration in JSON format",
},
{
displayName: "Data",
name: "data",
type: "json",
displayOptions: {
show: {
operation: ["bindConnector"],
},
},
default: "{}",
description: "Data for connector binding in JSON format",
},
];
//# sourceMappingURL=OpenLinesDescription.js.map