@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
1,141 lines • 34.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.botEventListenerFields = exports.chatBotMessageFields = exports.botMessageFields = exports.chatBotCommandFields = exports.botCommandFields = exports.chatBotUnregistrationFields = exports.botUnregistrationFields = exports.chatBotRegistrationFields = exports.botRegistrationFields = exports.chatNotificationFields = exports.chatConversationFields = exports.chatMessageFields = exports.botOperationFields = exports.chatOperationFields = void 0;
// Common fields used in chat operations
exports.chatOperationFields = [
// Operation selector for chat operations
{
displayName: "Operation",
name: "operation",
type: "options",
noDataExpression: true,
displayOptions: {
show: {
resource: ["chat"],
},
},
options: [
{
name: "Send Message",
value: "sendMessage",
description: "Send a message in a chat",
action: "Send a message in a chat",
},
{
name: "Get Messages",
value: "getMessages",
description: "Get messages from a chat",
action: "Get messages from a chat",
},
{
name: "Create Chat",
value: "createChat",
description: "Create a new chat",
action: "Create a chat",
},
{
name: "Add Users To Chat",
value: "addUsersToChat",
description: "Add users to a chat",
action: "Add users to a chat",
},
{
name: "Send Notification",
value: "sendNotification",
description: "Send a notification",
action: "Send a notification",
},
{
name: "Register Bot",
value: "registerBot",
description: "Register a new bot",
action: "Register a new bot",
},
{
name: "Unregister Bot",
value: "unregisterBot",
description: "Unregister an existing bot",
action: "Unregister a bot",
},
{
name: "Add Bot Command",
value: "addBotCommand",
description: "Add a command to a bot",
action: "Add a command to a bot",
},
{
name: "Delete Bot Command",
value: "deleteBotCommand",
description: "Delete a command from a bot",
action: "Delete a command from a bot",
},
{
name: "Get Bot Commands",
value: "getBotCommands",
description: "Get all commands of a bot",
action: "Get all commands of a bot",
},
{
name: "Send Bot Message",
value: "sendBotMessage",
description: "Send a message as a bot",
action: "Send a message as a bot",
},
],
default: "sendMessage",
},
];
// Common fields used in bot operations
exports.botOperationFields = [
// Operation selector for bot operations
{
displayName: "Operation",
name: "operation",
type: "options",
noDataExpression: true,
displayOptions: {
show: {
resource: ["bot"],
},
},
options: [
{
name: "Register Bot",
value: "registerBot",
description: "Register a new bot",
action: "Register a new bot",
},
{
name: "Unregister Bot",
value: "unregisterBot",
description: "Unregister an existing bot",
action: "Unregister a bot",
},
{
name: "Add Command",
value: "addCommand",
description: "Add a command to a bot",
action: "Add a command to a bot",
},
{
name: "Delete Command",
value: "deleteCommand",
description: "Delete a command from a bot",
action: "Delete a command from a bot",
},
{
name: "Get Commands",
value: "getCommands",
description: "Get all commands of a bot",
action: "Get all commands of a bot",
},
{
name: "Send Message",
value: "sendMessage",
description: "Send a message as a bot",
action: "Send a message as a bot",
},
{
name: "Register Event Handler",
value: "registerEventHandler",
description: "Register a URL to handle bot events",
action: "Register a URL to handle bot events",
},
{
name: "Unregister Event Handler",
value: "unregisterEventHandler",
description: "Unregister a bot event handler",
action: "Unregister a bot event handler",
},
],
default: "registerBot",
},
];
exports.chatMessageFields = [
// Fields for sending a message
{
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["message"],
operation: ["sendMessage", "getMessages"],
},
},
default: "",
description: "The ID of the chat",
},
{
displayName: "Message",
name: "message",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["message"],
operation: ["sendMessage"],
},
},
default: "",
typeOptions: {
rows: 4,
},
description: "The message text to send",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["message"],
operation: ["sendMessage"],
},
},
options: [
{
displayName: "Attach Files",
name: "attachFiles",
type: "boolean",
default: false,
description: "Whether to attach files to the message",
},
{
displayName: "Binary Property",
name: "binaryPropertyName",
type: "string",
default: "data",
required: true,
displayOptions: {
show: {
attachFiles: [true],
},
},
description: "The name of the binary property which contains the file data for the attachment",
},
{
displayName: "System",
name: "system",
type: "boolean",
default: false,
description: "Whether the message is a system message",
},
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
exports.chatConversationFields = [
// Fields for chat operations
{
displayName: "Title",
name: "title",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["chat"],
operation: ["createChat"],
},
},
default: "",
description: "The title of the chat",
},
{
displayName: "User IDs",
name: "userIds",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["chat"],
operation: ["createChat", "addUsersToChat"],
},
},
default: "",
description: "Comma-separated list of user IDs to add to the chat",
},
{
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["chat"],
operation: ["addUsersToChat"],
},
},
default: "",
description: "The ID of the chat to add users to",
},
];
exports.chatNotificationFields = [
// Fields for notification operations
{
displayName: "User ID",
name: "userId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["notification"],
operation: ["sendNotification"],
},
},
default: "",
description: "The ID of the user to send the notification to",
},
{
displayName: "Message",
name: "message",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["notification"],
operation: ["sendNotification"],
},
},
default: "",
typeOptions: {
rows: 4,
},
description: "The notification message text",
},
{
displayName: "Tag",
name: "tag",
type: "string",
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["notification"],
operation: ["sendNotification"],
},
},
default: "",
description: "Tag to categorize the notification",
},
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
displayOptions: {
show: {
resource: ["chat"],
chatResource: ["notification"],
operation: ["sendNotification"],
},
},
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
];
// Bot registration fields for both resources
exports.botRegistrationFields = [
// Fields for bot registration
{
displayName: "Code",
name: "code",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerBot"],
},
},
default: "",
description: "Authorization code received in the redirect URL",
},
{
displayName: "Event Handler URL",
name: "eventHandlerUrl",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerBot"],
},
},
default: "",
description: "URL where bot events will be sent",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerBot"],
},
},
options: [
{
displayName: "Type",
name: "type",
type: "options",
options: [
{
name: "Human",
value: "H",
},
{
name: "Chat Bot",
value: "B",
},
{
name: "Open Channels",
value: "O",
},
{
name: "Network Bot",
value: "N",
},
],
default: "B",
description: "Type of the bot",
},
{
displayName: "Event Types",
name: "eventTypes",
type: "multiOptions",
options: [
{
name: "Message Add",
value: "ONIMBOTMESSAGEADD",
},
{
name: "Chat Add",
value: "ONIMBOTJOINCHAT",
},
{
name: "Delete Message",
value: "ONIMBOTDELETE",
},
{
name: "Message Update",
value: "ONIMBOTMESSAGEUPDATE",
},
],
default: ["ONIMBOTMESSAGEADD"],
description: "Types of events the bot will listen to",
},
{
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: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
// Duplicate for chat resource
exports.chatBotRegistrationFields = [
// Fields for bot registration
{
displayName: "Code",
name: "code",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["registerBot"],
},
},
default: "",
description: "Authorization code received in the redirect URL",
},
{
displayName: "Event Handler URL",
name: "eventHandlerUrl",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["registerBot"],
},
},
default: "",
description: "URL where bot events will be sent",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["chat"],
operation: ["registerBot"],
},
},
options: [
{
displayName: "Type",
name: "type",
type: "options",
options: [
{
name: "Human",
value: "H",
},
{
name: "Chat Bot",
value: "B",
},
{
name: "Open Channels",
value: "O",
},
{
name: "Network Bot",
value: "N",
},
],
default: "B",
description: "Type of the bot",
},
{
displayName: "Event Types",
name: "eventTypes",
type: "multiOptions",
options: [
{
name: "Message Add",
value: "ONIMBOTMESSAGEADD",
},
{
name: "Chat Add",
value: "ONIMBOTJOINCHAT",
},
{
name: "Delete Message",
value: "ONIMBOTDELETE",
},
{
name: "Message Update",
value: "ONIMBOTMESSAGEUPDATE",
},
],
default: ["ONIMBOTMESSAGEADD"],
description: "Types of events the bot will listen to",
},
{
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: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
exports.botUnregistrationFields = [
// Fields for bot unregistration
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["unregisterBot"],
},
},
default: "",
description: "ID of the bot to unregister",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["bot"],
operation: ["unregisterBot"],
},
},
options: [
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
exports.chatBotUnregistrationFields = [
// Fields for bot unregistration
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["unregisterBot"],
},
},
default: "",
description: "ID of the bot to unregister",
},
];
exports.botCommandFields = [
// Fields for bot command operations
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["addCommand", "deleteCommand", "getCommands"],
},
},
default: "",
description: "ID of the bot",
},
{
displayName: "Command",
name: "command",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["addCommand", "deleteCommand"],
},
},
default: "",
description: "Command text (e.g., help, start)",
},
{
displayName: "Command Description",
name: "commandDescription",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["addCommand"],
},
},
default: "",
description: "Description of what the command does",
},
{
displayName: "Command Params",
name: "commandParams",
type: "string",
displayOptions: {
show: {
resource: ["bot"],
operation: ["addCommand"],
},
},
default: "",
description: "Additional parameters for the command",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["bot"],
operation: ["addCommand", "deleteCommand", "getCommands"],
},
},
options: [
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
exports.chatBotCommandFields = [
// Fields for bot command operations
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["addBotCommand", "deleteBotCommand", "getBotCommands"],
},
},
default: "",
description: "ID of the bot",
},
{
displayName: "Command",
name: "command",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["addBotCommand", "deleteBotCommand"],
},
},
default: "",
description: "Command text (e.g., help, start)",
},
{
displayName: "Command Description",
name: "commandDescription",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["addBotCommand"],
},
},
default: "",
description: "Description of what the command does",
},
{
displayName: "Command Params",
name: "commandParams",
type: "string",
displayOptions: {
show: {
resource: ["chat"],
operation: ["addBotCommand"],
},
},
default: "",
description: "Additional parameters for the command",
},
];
exports.botMessageFields = [
// Fields for sending messages as a bot
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["sendMessage"],
},
},
default: "",
description: "ID of the bot sending the message",
},
{
displayName: "Dialog ID",
name: "dialogId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["sendMessage"],
},
},
default: "",
description: "ID of the dialog to send the message to",
},
{
displayName: "Message",
name: "message",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["sendMessage"],
},
},
default: "",
typeOptions: {
rows: 4,
},
description: "The message text to send",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["bot"],
operation: ["sendMessage"],
},
},
options: [
{
displayName: "Attach Files",
name: "attachFiles",
type: "boolean",
default: false,
description: "Whether to attach files to the message",
},
{
displayName: "Binary Property",
name: "binaryPropertyName",
type: "string",
default: "data",
required: true,
displayOptions: {
show: {
attachFiles: [true],
},
},
description: "The name of the binary property which contains the file data for the attachment",
},
{
displayName: "Keyboard",
name: "keyboard",
type: "boolean",
default: false,
description: "Whether to add a keyboard to the message",
},
{
displayName: "Keyboard JSON",
name: "keyboardJson",
type: "string",
default: "",
typeOptions: {
rows: 4,
},
displayOptions: {
show: {
keyboard: [true],
},
},
description: "JSON representation of the keyboard buttons",
},
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
exports.chatBotMessageFields = [
// Fields for sending messages as a bot
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["sendBotMessage"],
},
},
default: "",
description: "ID of the bot sending the message",
},
{
displayName: "Dialog ID",
name: "dialogId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["sendBotMessage"],
},
},
default: "",
description: "ID of the dialog to send the message to",
},
{
displayName: "Message",
name: "message",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["chat"],
operation: ["sendBotMessage"],
},
},
default: "",
typeOptions: {
rows: 4,
},
description: "The message text to send",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["chat"],
operation: ["sendBotMessage"],
},
},
options: [
{
displayName: "Attach Files",
name: "attachFiles",
type: "boolean",
default: false,
description: "Whether to attach files to the message",
},
{
displayName: "Binary Property",
name: "binaryPropertyName",
type: "string",
default: "data",
required: true,
displayOptions: {
show: {
attachFiles: [true],
},
},
description: "The name of the binary property which contains the file data for the attachment",
},
{
displayName: "Keyboard",
name: "keyboard",
type: "boolean",
default: false,
description: "Whether to add a keyboard to the message",
},
{
displayName: "Keyboard JSON",
name: "keyboardJson",
type: "string",
default: "",
typeOptions: {
rows: 4,
},
displayOptions: {
show: {
keyboard: [true],
},
},
description: "JSON representation of the keyboard buttons",
},
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
exports.botEventListenerFields = [
// Fields for event listener operations
{
displayName: "Bot ID",
name: "botId",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerEventHandler", "unregisterEventHandler"],
},
},
default: "",
description: "ID of the bot",
},
{
displayName: "Event Type",
name: "eventType",
type: "options",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerEventHandler", "unregisterEventHandler"],
},
},
options: [
{
name: "Message Add",
value: "ONIMBOTMESSAGEADD",
},
{
name: "Chat Add",
value: "ONIMBOTJOINCHAT",
},
{
name: "Delete Message",
value: "ONIMBOTDELETE",
},
{
name: "Message Update",
value: "ONIMBOTMESSAGEUPDATE",
},
],
default: "ONIMBOTMESSAGEADD",
description: "Type of event to handle",
},
{
displayName: "Handler URL",
name: "handlerUrl",
type: "string",
required: true,
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerEventHandler"],
},
},
default: "",
description: "URL that will handle the event",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["bot"],
operation: ["registerEventHandler", "unregisterEventHandler"],
},
},
options: [
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
default: "",
description: "Additional parameters in JSON format to include in the request",
hint: "Enter a JSON object with key-value pairs that will be merged with other parameters",
typeOptions: {
rows: 2,
},
},
],
},
];
//# sourceMappingURL=BotAndChatDescription.js.map