@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
677 lines • 18.4 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.chatDiskFileOperationFields = exports.chatNotificationGetFields = exports.chatMessageReactionFields = exports.chatMessageReplyFields = exports.chatMessageForwardFields = exports.chatMessagePinFields = exports.chatByUserFields = exports.chatPinFields = exports.chatDiskFields = exports.chatUserStatusFields = exports.chatNotificationFields = exports.chatDetailsFields = exports.chatOptionsFields = exports.chatListFields = exports.chatMessageFields = exports.chatChatFields = exports.chatOperationFields = void 0;
const ModuleManager_1 = require("../ModuleManager");
// Chat 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 to chat",
action: "Send a message to chat",
},
{
name: "Get Messages",
value: "getMessages",
description: "Get chat messages",
action: "Get chat messages",
},
{
name: "Get Chat",
value: "getChat",
description: "Get chat information",
action: "Get chat information",
},
{
name: "Get Chats",
value: "getChats",
description: "Get list of chats",
action: "Get list of chats",
},
{
name: "Create Chat",
value: "createChat",
description: "Create a new chat",
action: "Create a new chat",
},
{
name: "Update Chat",
value: "updateChat",
description: "Update chat information",
action: "Update chat information",
},
],
default: "getChats",
}, ModuleManager_1.BITRIX24_MODULES.CHAT);
// Chat ID field
const chatIdField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
default: "",
displayOptions: {
show: {
operation: [
"get",
"join",
"leave",
"setOwner",
"setTitle",
"setDescription",
"setColor",
"setAvatar",
"deleteMessage",
"readMessage",
"unreadMessage",
"pinMessage",
"unpinMessage",
],
},
},
description: "ID of the chat",
}, ModuleManager_1.BITRIX24_MODULES.CHAT, {
operation: ["sendMessage", "getMessages", "getChat", "updateChat"],
});
// Message field
const messageField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Message",
name: "message",
type: "string",
required: true,
default: "",
displayOptions: {
show: {
operation: ["sendMessage", "updateMessage"],
},
},
description: "Message text to send",
}, ModuleManager_1.BITRIX24_MODULES.CHAT, {
operation: ["sendMessage"],
});
// Chat Title field
const chatTitleField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Chat Title",
name: "chatTitle",
type: "string",
required: true,
default: "",
description: "Title of the chat",
}, ModuleManager_1.BITRIX24_MODULES.CHAT, {
operation: ["createChat", "updateChat"],
});
// Chat Type field
const chatTypeField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Chat Type",
name: "chatType",
type: "options",
options: [
{ name: "Chat", value: "CHAT" },
{ name: "Open Line", value: "OPENLINE" },
{ name: "Call", value: "CALL" },
],
default: "CHAT",
description: "Type of the chat",
}, ModuleManager_1.BITRIX24_MODULES.CHAT, {
operation: ["createChat"],
});
// Users field
const usersField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Users",
name: "users",
type: "string",
default: "",
description: "Comma-separated list of user IDs",
}, ModuleManager_1.BITRIX24_MODULES.CHAT, {
operation: ["createChat"],
});
// 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.CHAT, {
operation: ["getChats", "getMessages"],
});
// 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.CHAT, {
operation: ["getChats", "getMessages"],
returnAll: [false],
});
// Options collection
const optionsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Options", ModuleManager_1.BITRIX24_MODULES.CHAT, {}, [
{
displayName: "Access Token",
name: "accessToken",
type: "string",
default: "",
description: "Access token for authentication",
},
{
displayName: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter criteria",
},
{
displayName: "Start",
name: "start",
type: "number",
default: 0,
description: "Start position for pagination",
},
]);
exports.chatOperationFields = [operationField];
exports.chatChatFields = [
chatIdField,
chatTitleField,
chatTypeField,
usersField,
];
exports.chatMessageFields = [messageField];
exports.chatListFields = [returnAllField, limitField];
exports.chatOptionsFields = [optionsCollection];
// Fields for chat operations
exports.chatDetailsFields = [
// Fields for create chat
{
displayName: "Title",
name: "title",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["createChat"],
},
},
default: "",
description: "The title of the chat",
},
{
displayName: "User IDs",
name: "userIds",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["createChat", "addUserToChat"],
},
},
default: "",
description: "Comma-separated list of user IDs to add to the chat",
},
{
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
displayOptions: {
show: {
operation: [
"getChatUsers",
"addUserToChat",
"deleteUserFromChat",
"getChat",
"setChatOwner",
"setChatTitle",
"setChatAvatar",
"setChatDescription",
"setChatColor",
"setChatBackground",
],
},
},
default: "",
description: "The ID of the chat",
},
{
displayName: "User ID",
name: "userId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["deleteUserFromChat", "setChatOwner"],
},
},
default: "",
description: "The ID of the user",
},
{
displayName: "New Title",
name: "newTitle",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["setChatTitle"],
},
},
default: "",
description: "The new title for the chat",
},
{
displayName: "Description",
name: "description",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["setChatDescription"],
},
},
default: "",
description: "The new description for the chat",
},
{
displayName: "Color",
name: "color",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["setChatColor"],
},
},
default: "",
description: "The new color for the chat (e.g. #FF0000)",
},
{
displayName: "File ID",
name: "fileId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["setChatAvatar", "setChatBackground"],
},
},
default: "",
description: "The ID of the file",
},
];
// Fields for notification operations
exports.chatNotificationFields = [
{
displayName: "User ID",
name: "userId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["sendNotification", "sendSystemMessage"],
},
},
default: "",
description: "The ID of the user to send the notification to",
},
{
displayName: "Message",
name: "message",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["sendNotification", "sendSystemMessage"],
},
},
default: "",
typeOptions: {
rows: 4,
},
description: "The notification message text",
},
{
displayName: "Tag",
name: "tag",
type: "string",
displayOptions: {
show: {
operation: ["sendNotification"],
},
},
default: "",
description: "Tag to categorize the notification",
},
{
displayName: "Custom Parameters",
name: "customParameters",
type: "string",
displayOptions: {
show: {
operation: ["sendNotification", "sendSystemMessage"],
},
},
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,
},
},
];
// Fields for user status operations
exports.chatUserStatusFields = [
{
displayName: "User ID",
name: "userId",
type: "string",
displayOptions: {
show: {
operation: ["getUserStatus"],
},
},
default: "",
description: "The ID of the user (leave empty for current user)",
},
{
displayName: "Status",
name: "status",
type: "options",
required: true,
displayOptions: {
show: {
operation: ["setUserStatus"],
},
},
options: [
{
name: "Online",
value: "online",
},
{
name: "Offline",
value: "offline",
},
{
name: "Away",
value: "away",
},
{
name: "Do Not Disturb",
value: "dnd",
},
],
default: "online",
description: "The new status to set",
},
];
// Fields for disk operations
exports.chatDiskFields = [
{
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["uploadFile", "getDiskFolder"],
},
},
default: "",
description: "The ID of the chat",
},
{
displayName: "Binary Property",
name: "binaryPropertyName",
type: "string",
default: "data",
required: true,
displayOptions: {
show: {
operation: ["uploadFile"],
},
},
description: "The name of the binary property which contains the file data",
},
];
// Additional fields for the new operations
exports.chatPinFields = [
{
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
displayOptions: {
show: {
operation: [
"pinChat",
"unpinChat",
"hideChat",
"showChat",
"muteNotifications",
"unmuteNotifications",
"leaveChat",
"joinChat",
],
},
},
default: "",
description: "The ID of the chat",
},
];
exports.chatByUserFields = [
{
displayName: "User ID",
name: "userId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["getChatByUser"],
},
},
default: "",
description: "The ID of the user",
},
];
exports.chatMessagePinFields = [
{
displayName: "Chat ID",
name: "chatId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["pinMessage", "unpinMessage"],
},
},
default: "",
description: "The ID of the chat",
},
{
displayName: "Message ID",
name: "messageId",
type: "string",
required: true,
displayOptions: {
show: {
operation: [
"pinMessage",
"unpinMessage",
"forwardMessage",
"replyToMessage",
],
},
},
default: "",
description: "The ID of the message",
},
];
exports.chatMessageForwardFields = [
{
displayName: "Source Dialog ID",
name: "sourceDialogId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["forwardMessage"],
},
},
default: "",
description: "The ID of the source dialog",
},
{
displayName: "Target Dialog ID",
name: "targetDialogId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["forwardMessage", "replyToMessage"],
},
},
default: "",
description: "The ID of the target dialog",
},
];
exports.chatMessageReplyFields = [
{
displayName: "Message",
name: "message",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["replyToMessage"],
},
},
default: "",
typeOptions: {
rows: 4,
},
description: "The reply message text",
},
];
exports.chatMessageReactionFields = [
{
displayName: "Message ID",
name: "messageId",
type: "string",
required: true,
displayOptions: {
show: {
operation: [
"getMessageReactions",
"addMessageReaction",
"deleteMessageReaction",
],
},
},
default: "",
description: "The ID of the message",
},
{
displayName: "Reaction",
name: "reaction",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["addMessageReaction", "deleteMessageReaction"],
},
},
default: "",
description: "The reaction emoji code",
},
];
exports.chatNotificationGetFields = [
{
displayName: "User ID",
name: "userId",
type: "string",
displayOptions: {
show: {
operation: ["getNotifications", "markNotificationsAsRead"],
},
},
default: "",
description: "The ID of the user (leave empty for current user)",
},
{
displayName: "Notification ID",
name: "notificationId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["deleteNotification"],
},
},
default: "",
description: "The ID of the notification",
},
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
operation: ["getNotifications"],
},
},
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.chatDiskFileOperationFields = [
{
displayName: "File ID",
name: "fileId",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["downloadFile", "deleteFile"],
},
},
default: "",
description: "The ID of the file",
},
{
displayName: "File Data",
name: "fileData",
type: "string",
required: true,
displayOptions: {
show: {
operation: ["commitFile"],
},
},
default: "",
description: "The file data token",
},
];
//# sourceMappingURL=ChatDescription.js.map