n8n-nodes-pachca 1.0.27 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +193 -256
  3. package/dist/credentials/PachcaApi.credentials.d.ts +5 -1
  4. package/dist/credentials/PachcaApi.credentials.js +31 -34
  5. package/dist/credentials/PachcaApi.credentials.js.map +1 -0
  6. package/dist/credentials/pachca.dark.svg +3 -0
  7. package/dist/credentials/pachca.svg +3 -0
  8. package/dist/icons/pachca.dark.svg +3 -0
  9. package/dist/icons/pachca.svg +3 -0
  10. package/dist/nodes/Pachca/GenericFunctions.d.ts +89 -0
  11. package/dist/nodes/Pachca/GenericFunctions.js +896 -0
  12. package/dist/nodes/Pachca/GenericFunctions.js.map +1 -0
  13. package/dist/nodes/Pachca/Pachca.node.d.ts +3 -4
  14. package/dist/nodes/Pachca/Pachca.node.js +14 -4772
  15. package/dist/nodes/Pachca/Pachca.node.js.map +1 -0
  16. package/dist/nodes/Pachca/Pachca.node.json +24 -0
  17. package/dist/nodes/Pachca/PachcaTrigger.node.d.ts +12 -0
  18. package/dist/nodes/Pachca/PachcaTrigger.node.js +203 -0
  19. package/dist/nodes/Pachca/PachcaTrigger.node.js.map +1 -0
  20. package/dist/nodes/Pachca/PachcaTrigger.node.json +24 -0
  21. package/dist/nodes/Pachca/SharedRouter.d.ts +2 -0
  22. package/dist/nodes/Pachca/SharedRouter.js +994 -0
  23. package/dist/nodes/Pachca/SharedRouter.js.map +1 -0
  24. package/dist/nodes/Pachca/V1/BotDescription.d.ts +3 -0
  25. package/dist/nodes/Pachca/V1/BotDescription.js +58 -0
  26. package/dist/nodes/Pachca/V1/BotDescription.js.map +1 -0
  27. package/dist/nodes/Pachca/V1/ChatDescription.d.ts +3 -0
  28. package/dist/nodes/Pachca/V1/ChatDescription.js +305 -0
  29. package/dist/nodes/Pachca/V1/ChatDescription.js.map +1 -0
  30. package/dist/nodes/Pachca/V1/CustomFieldsDescription.d.ts +3 -0
  31. package/dist/nodes/Pachca/V1/CustomFieldsDescription.js +86 -0
  32. package/dist/nodes/Pachca/V1/CustomFieldsDescription.js.map +1 -0
  33. package/dist/nodes/Pachca/V1/FileDescription.d.ts +3 -0
  34. package/dist/nodes/Pachca/V1/FileDescription.js +111 -0
  35. package/dist/nodes/Pachca/V1/FileDescription.js.map +1 -0
  36. package/dist/nodes/Pachca/V1/FormDescription.d.ts +3 -0
  37. package/dist/nodes/Pachca/V1/FormDescription.js +517 -0
  38. package/dist/nodes/Pachca/V1/FormDescription.js.map +1 -0
  39. package/dist/nodes/Pachca/V1/GroupTagDescription.d.ts +3 -0
  40. package/dist/nodes/Pachca/V1/GroupTagDescription.js +181 -0
  41. package/dist/nodes/Pachca/V1/GroupTagDescription.js.map +1 -0
  42. package/dist/nodes/Pachca/V1/MessageDescription.d.ts +3 -0
  43. package/dist/nodes/Pachca/V1/MessageDescription.js +502 -0
  44. package/dist/nodes/Pachca/V1/MessageDescription.js.map +1 -0
  45. package/dist/nodes/Pachca/V1/PachcaV1.node.d.ts +16 -0
  46. package/dist/nodes/Pachca/V1/PachcaV1.node.js +201 -0
  47. package/dist/nodes/Pachca/V1/PachcaV1.node.js.map +1 -0
  48. package/dist/nodes/Pachca/V1/ReactionsDescription.d.ts +3 -0
  49. package/dist/nodes/Pachca/V1/ReactionsDescription.js +99 -0
  50. package/dist/nodes/Pachca/V1/ReactionsDescription.js.map +1 -0
  51. package/dist/nodes/Pachca/V1/StatusDescription.d.ts +3 -0
  52. package/dist/nodes/Pachca/V1/StatusDescription.js +89 -0
  53. package/dist/nodes/Pachca/V1/StatusDescription.js.map +1 -0
  54. package/dist/nodes/Pachca/V1/TaskDescription.d.ts +3 -0
  55. package/dist/nodes/Pachca/V1/TaskDescription.js +182 -0
  56. package/dist/nodes/Pachca/V1/TaskDescription.js.map +1 -0
  57. package/dist/nodes/Pachca/V1/ThreadDescription.d.ts +3 -0
  58. package/dist/nodes/Pachca/V1/ThreadDescription.js +64 -0
  59. package/dist/nodes/Pachca/V1/ThreadDescription.js.map +1 -0
  60. package/dist/nodes/Pachca/V1/UserDescription.d.ts +3 -0
  61. package/dist/nodes/Pachca/V1/UserDescription.js +367 -0
  62. package/dist/nodes/Pachca/V1/UserDescription.js.map +1 -0
  63. package/dist/nodes/Pachca/V2/BotDescription.d.ts +3 -0
  64. package/dist/nodes/Pachca/V2/BotDescription.js +86 -0
  65. package/dist/nodes/Pachca/V2/BotDescription.js.map +1 -0
  66. package/dist/nodes/Pachca/V2/ChatDescription.d.ts +3 -0
  67. package/dist/nodes/Pachca/V2/ChatDescription.js +354 -0
  68. package/dist/nodes/Pachca/V2/ChatDescription.js.map +1 -0
  69. package/dist/nodes/Pachca/V2/CustomPropertyDescription.d.ts +3 -0
  70. package/dist/nodes/Pachca/V2/CustomPropertyDescription.js +42 -0
  71. package/dist/nodes/Pachca/V2/CustomPropertyDescription.js.map +1 -0
  72. package/dist/nodes/Pachca/V2/ExportDescription.d.ts +3 -0
  73. package/dist/nodes/Pachca/V2/ExportDescription.js +111 -0
  74. package/dist/nodes/Pachca/V2/ExportDescription.js.map +1 -0
  75. package/dist/nodes/Pachca/V2/FileDescription.d.ts +3 -0
  76. package/dist/nodes/Pachca/V2/FileDescription.js +77 -0
  77. package/dist/nodes/Pachca/V2/FileDescription.js.map +1 -0
  78. package/dist/nodes/Pachca/V2/FormDescription.d.ts +3 -0
  79. package/dist/nodes/Pachca/V2/FormDescription.js +311 -0
  80. package/dist/nodes/Pachca/V2/FormDescription.js.map +1 -0
  81. package/dist/nodes/Pachca/V2/GroupTagDescription.d.ts +3 -0
  82. package/dist/nodes/Pachca/V2/GroupTagDescription.js +216 -0
  83. package/dist/nodes/Pachca/V2/GroupTagDescription.js.map +1 -0
  84. package/dist/nodes/Pachca/V2/LinkPreviewDescription.d.ts +3 -0
  85. package/dist/nodes/Pachca/V2/LinkPreviewDescription.js +42 -0
  86. package/dist/nodes/Pachca/V2/LinkPreviewDescription.js.map +1 -0
  87. package/dist/nodes/Pachca/V2/MemberDescription.d.ts +3 -0
  88. package/dist/nodes/Pachca/V2/MemberDescription.js +427 -0
  89. package/dist/nodes/Pachca/V2/MemberDescription.js.map +1 -0
  90. package/dist/nodes/Pachca/V2/MessageDescription.d.ts +3 -0
  91. package/dist/nodes/Pachca/V2/MessageDescription.js +589 -0
  92. package/dist/nodes/Pachca/V2/MessageDescription.js.map +1 -0
  93. package/dist/nodes/Pachca/V2/PachcaV2.node.d.ts +17 -0
  94. package/dist/nodes/Pachca/V2/PachcaV2.node.js +111 -0
  95. package/dist/nodes/Pachca/V2/PachcaV2.node.js.map +1 -0
  96. package/dist/nodes/Pachca/V2/ProfileDescription.d.ts +3 -0
  97. package/dist/nodes/Pachca/V2/ProfileDescription.js +144 -0
  98. package/dist/nodes/Pachca/V2/ProfileDescription.js.map +1 -0
  99. package/dist/nodes/Pachca/V2/ReactionDescription.d.ts +3 -0
  100. package/dist/nodes/Pachca/V2/ReactionDescription.js +136 -0
  101. package/dist/nodes/Pachca/V2/ReactionDescription.js.map +1 -0
  102. package/dist/nodes/Pachca/V2/ReadMemberDescription.d.ts +3 -0
  103. package/dist/nodes/Pachca/V2/ReadMemberDescription.js +57 -0
  104. package/dist/nodes/Pachca/V2/ReadMemberDescription.js.map +1 -0
  105. package/dist/nodes/Pachca/V2/SearchDescription.d.ts +3 -0
  106. package/dist/nodes/Pachca/V2/SearchDescription.js +323 -0
  107. package/dist/nodes/Pachca/V2/SearchDescription.js.map +1 -0
  108. package/dist/nodes/Pachca/V2/SecurityDescription.d.ts +3 -0
  109. package/dist/nodes/Pachca/V2/SecurityDescription.js +160 -0
  110. package/dist/nodes/Pachca/V2/SecurityDescription.js.map +1 -0
  111. package/dist/nodes/Pachca/V2/TaskDescription.d.ts +3 -0
  112. package/dist/nodes/Pachca/V2/TaskDescription.js +332 -0
  113. package/dist/nodes/Pachca/V2/TaskDescription.js.map +1 -0
  114. package/dist/nodes/Pachca/V2/ThreadDescription.d.ts +3 -0
  115. package/dist/nodes/Pachca/V2/ThreadDescription.js +54 -0
  116. package/dist/nodes/Pachca/V2/ThreadDescription.js.map +1 -0
  117. package/dist/nodes/Pachca/V2/UserDescription.d.ts +3 -0
  118. package/dist/nodes/Pachca/V2/UserDescription.js +635 -0
  119. package/dist/nodes/Pachca/V2/UserDescription.js.map +1 -0
  120. package/dist/nodes/Pachca/pachca.dark.svg +3 -0
  121. package/dist/nodes/Pachca/pachca.svg +3 -0
  122. package/docs/CONTRIBUTORS.md +72 -0
  123. package/docs/DEVELOPMENT.md +136 -0
  124. package/examples/basic-usage.json +69 -0
  125. package/icons/pachca.dark.svg +3 -0
  126. package/icons/pachca.svg +3 -0
  127. package/index.js +1 -0
  128. package/package.json +46 -35
  129. package/dist/n8n-structure/credentials/PachcaApi.credentials.js +0 -73
  130. package/dist/n8n-structure/nodes/Pachca/Pachca.node.js +0 -4784
  131. package/dist/n8n-structure/nodes/Pachca/Pachca_dark_mark.png +0 -0
  132. package/dist/n8n-structure/nodes/Pachca/Pachca_white_mark.png +0 -0
  133. package/dist/n8n-structure/package.json +0 -70
  134. package/dist/nodes/Pachca/Pachca_dark_mark.png +0 -0
  135. package/dist/nodes/Pachca/Pachca_white_mark.png +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 n8n-nodes-pachca
3
+ Copyright (c) 2025 Pachca
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,346 +1,283 @@
1
- # n8n Pachca Node
1
+ # n8n-nodes-pachca
2
2
 
3
- Custom n8n node for integration with the Pachca messenger API. Automate work with users, messages, chats, files, and other Pachca resources.
3
+ Community node for [n8n](https://n8n.io/) to interact with the [Pachca API](https://dev.pachca.com/).
4
4
 
5
- ## Table of Contents
6
-
7
- - [Installation](#installation)
8
- - [Configuration](#configuration)
9
- - [Resources and Operations](#resources-and-operations)
10
- - [Usage Examples](#usage-examples)
11
- - [Troubleshooting](#troubleshooting)
12
- - [Support](#support)
5
+ Auto-generated from the [OpenAPI spec](https://github.com/pachca/openapi) — always in sync with the latest API.
13
6
 
14
7
  ## Installation
15
8
 
16
- ### Automatic installation
9
+ In your n8n instance:
17
10
 
18
- 1. Download the node archive:
19
- ```bash
20
- wget https://github.com/pachca/n8n-nodes-pachca/releases/latest/download/pachca-node-v2.2.2.tar.gz
21
- ```
11
+ 1. Go to **Settings > Community Nodes**
12
+ 2. Enter `n8n-nodes-pachca`
13
+ 3. Click **Install**
22
14
 
23
- 2. Extract to the custom nodes directory:
24
- ```bash
25
- tar -xzf pachca-node-v2.2.2.tar.gz -C /path/to/n8n/custom-nodes/
26
- ```
15
+ Or install via CLI:
27
16
 
28
- 3. Restart n8n:
29
17
  ```bash
30
- docker restart n8n-container
18
+ npm install n8n-nodes-pachca
31
19
  ```
32
20
 
33
- ### Manual installation
21
+ Or install from archive (Docker, custom n8n images):
34
22
 
35
- 1. Clone the repository:
36
23
  ```bash
37
- git clone https://github.com/pachca/n8n-nodes-pachca.git
38
- cd n8n-nodes-pachca
39
- ```
24
+ # Download from GitHub Releases
25
+ # Find the latest n8n-nodes-pachca.tgz at:
26
+ # https://github.com/pachca/openapi/releases?q=n8n
27
+ wget https://github.com/pachca/openapi/releases/download/n8n-v2.0.1/n8n-nodes-pachca.tgz
40
28
 
41
- 2. Install dependencies:
42
- ```bash
43
- npm install
44
- ```
29
+ # Via npm (recommended)
30
+ cd ~/.n8n/nodes && npm install ./n8n-nodes-pachca.tgz
45
31
 
46
- 3. Build the project:
47
- ```bash
48
- npm run build
49
- ```
32
+ # Or extract directly (no npm needed)
33
+ tar -xzf n8n-nodes-pachca.tgz -C ~/.n8n/nodes/
50
34
 
51
- 4. Restart n8n:
52
- ```bash
53
- docker restart n8n-container
35
+ # Restart n8n
54
36
  ```
55
37
 
56
- ## Configuration
38
+ ## Nodes
39
+
40
+ ### Pachca
57
41
 
58
- ### 1. Creating credentials
42
+ Main node for interacting with the Pachca API. Supports 18 resources and 65+ operations:
59
43
 
60
- 1. In n8n go to **Settings** → **Credentials**
61
- 2. Click **Add Credential**
62
- 3. Find **Pachca API** in the list
63
- 4. Fill in the fields:
64
- - **Base URL**: `https://api.pachca.com/api/shared/v1`
65
- - **Access Token**: Your Pachca API access token
44
+ | Resource | Operations |
45
+ |----------|-----------|
46
+ | Bot | Update, Get Many Events, Remove Events |
47
+ | Chat | Create, Get, Get Many, Update, Archive, Unarchive |
48
+ | Chat Export | Create, Get |
49
+ | Chat Member | Get Many, Create, Delete, Update, Leave, Add/Remove Group Tags |
50
+ | Custom Property | Get |
51
+ | File | Create (S3 two-stage upload) |
52
+ | Form | Create (visual builder, templates, or JSON) |
53
+ | Group Tag | Create, Get, Get Many, Update, Delete, Get Many Users |
54
+ | Link Preview | Create |
55
+ | Message | Create, Get, Get Many, Update, Delete, Pin, Unpin |
56
+ | Profile | Get Info, Get, Update/Delete Avatar, Get/Update/Delete Status |
57
+ | Reaction | Create, Delete, Get Many |
58
+ | Read Member | Get Many |
59
+ | Search | Chats, Messages, Users |
60
+ | Security | Get Many |
61
+ | Task | Create, Get, Get Many, Update, Delete |
62
+ | Thread | Create, Get |
63
+ | User | Create, Get, Get Many, Update, Delete, Update/Delete Avatar, Get/Update/Delete Status |
66
64
 
67
- ### 2. Obtaining an access token
65
+ ### Pachca Trigger
68
66
 
69
- To get an access token:
67
+ Webhook-based trigger that listens for 16 Pachca event types:
70
68
 
71
- 1. Log in to the Pachca web app
72
- 2. Go to **Settings** → **Integrations**
73
- 3. Create a new access token
74
- 4. Copy the token and paste it into the credentials settings
69
+ | Category | Events |
70
+ |----------|--------|
71
+ | Messages | new, updated, deleted |
72
+ | Reactions | new, deleted |
73
+ | Interactive | button pressed, form submitted, link shared |
74
+ | Chat members | added, removed |
75
+ | Users | invited, confirmed, activated, suspended, updated, deleted |
76
+ | Wildcard | all events |
75
77
 
76
- > **Important**: The token must have the required permissions for the operations you plan to perform.
78
+ Automatically registers webhooks via the Bot API when workflow is activated. Deactivation removes the webhook.
77
79
 
78
- ## Resources and Operations
80
+ ## Credentials
79
81
 
80
- ### User
82
+ Create a **Pachca API** credential with:
81
83
 
82
- | Operation | Description | Method |
83
- |-----------|-------------|--------|
84
- | Get All | Get list of all users | GET |
85
- | Get By ID | Get user by ID | GET |
86
- | Create | Create new user | POST |
87
- | Update | Update user data | PUT |
88
- | Delete | Delete user | DELETE |
84
+ | Field | Required | Description |
85
+ |-------|----------|-------------|
86
+ | **Base URL** | no | Default: `https://api.pachca.com/api/shared/v1`. Change only for on-premise. |
87
+ | **Access Token** | yes | Bot or personal API token |
88
+ | **Bot ID** | no | For automatic webhook registration in Trigger. Auto-detected from bot tokens. Set explicitly for admin tokens. |
89
+ | **Signing Secret** | no | For HMAC-SHA256 verification of incoming webhooks (`pachca-signature` header) |
90
+ | **Webhook Allowed IPs** | no | Comma-separated IPs allowed to send webhooks. Pachca sends from `37.200.70.177`. Empty = allow all. |
89
91
 
90
- **Update parameters:**
91
- - First Name, Last Name, Email
92
- - Nickname, Phone Number
93
- - Department, Title, Role
94
- - Suspended (deactivation)
95
- - List Tags (comma-separated tags)
96
- - Custom Properties (additional fields)
92
+ **Where to get tokens:**
97
93
 
98
- ### Message
94
+ - **Bot token** — Bot settings > API tab
95
+ - **Personal token** — Settings > Automations > API
99
96
 
100
- | Operation | Description | Method |
101
- |-----------|-------------|--------|
102
- | Send | Send message | POST |
103
- | Get All By Chat | Get chat messages | GET |
104
- | Get By ID | Get message by ID | GET |
105
- | Update | Edit message | PUT |
106
- | Delete | Delete message | DELETE |
107
- | Get Read Members | Get list of readers | GET |
97
+ Credentials are tested by calling `GET /oauth/token/info`.
108
98
 
109
- ### Chat
99
+ ## Key Features
110
100
 
111
- | Operation | Description | Method |
112
- |-----------|-------------|--------|
113
- | Get All | Get list of chats | GET |
114
- | Get By ID | Get chat by ID | GET |
115
- | Create | Create new chat | POST |
116
- | Update | Update chat | PUT |
117
- | Archive | Archive chat | PUT |
118
- | Unarchive | Unarchive chat | PUT |
101
+ ### Pagination
102
+
103
+ All list operations (Get Many) support automatic cursor-based pagination:
104
+
105
+ - **Return All** = true fetches all pages automatically
106
+ - **Return All** = false returns up to **Limit** results (default: 50)
107
+
108
+ ### Simplify
109
+
110
+ Toggle **Simplify** (on by default) to return only key fields from API responses. Turn off for full response.
111
+
112
+ - **Message** — id, entity_id, chat_id, content, user_id, created_at
113
+ - **Chat** — id, name, channel, public, members_count, created_at
114
+ - **User** — id, first_name, last_name, nickname, email, role, suspended
115
+ - **Task** — id, content, kind, status, priority, due_at, created_at
116
+
117
+ ### Searchable Dropdowns
118
+
119
+ Chat ID and User ID fields support search by name — type to find instead of entering numeric IDs.
120
+
121
+ ### Message Buttons
122
+
123
+ Create messages with interactive buttons via JSON:
124
+
125
+ ```json
126
+ [[{"text": "Approve", "data": "approve"}, {"text": "Reject", "data": "reject"}]]
127
+ ```
119
128
 
120
- **Create parameters:**
121
- - Chat Name
122
- - Channel (channel/direct switch)
123
- - Public (public/private switch)
129
+ Button types: **URL** (opens link) and **Data** (sends `button_pressed` webhook event).
124
130
 
125
- ### Group Tag
131
+ ### Forms
126
132
 
127
- | Operation | Description | Method |
128
- |-----------|-------------|--------|
129
- | Get All | Get all tags | GET |
130
- | Get By ID | Get tag by ID | GET |
131
- | Create | Create new tag | POST |
132
- | Update | Update tag | PUT |
133
- | Delete | Delete tag | DELETE |
134
- | Add Tags | Add tags to chat | POST |
135
- | Remove Tag | Remove tag from chat | DELETE |
133
+ Create modal forms with three builder modes:
136
134
 
137
- ### File
135
+ - **Visual Builder** — add blocks (text input, select, radio, checkboxes, date/time, file upload)
136
+ - **Templates** — predefined forms (Feedback, Time Off, Survey, Bug Report)
137
+ - **JSON** — paste blocks from the visual playground
138
138
 
139
- | Operation | Description | Method |
140
- |-----------|-------------|--------|
141
- | Upload | Upload file | POST |
142
- | Get Upload Params | Get upload parameters | POST |
139
+ Forms require a `trigger_id` from a `button_pressed` webhook event (valid for 3 seconds).
143
140
 
144
- **Supported file sources:**
145
- - URL (file link)
146
- - Binary (binary data from previous nodes)
141
+ ### Avatar Upload
147
142
 
148
- ### Custom Fields
143
+ Upload avatar images for profiles and users via `multipart/form-data`. Uses binary data from a previous node (HTTP Request, Read Binary File). The **Input Binary Field** parameter (default: `data`) specifies which binary property contains the image.
149
144
 
150
- | Operation | Description | Method |
151
- |-----------|-------------|--------|
152
- | Get Custom Properties | Get list of fields | GET |
145
+ ### File Upload
153
146
 
154
- ### Task
147
+ Two-stage S3 upload with automatic retry. Sources: **URL** or **Binary Data** from previous workflow nodes.
155
148
 
156
- | Operation | Description | Method |
157
- |-----------|-------------|--------|
158
- | Create | Create task | POST |
149
+ ### AI Tool Use
159
150
 
160
- ### Bot
161
-
162
- | Operation | Description | Method |
163
- |-----------|-------------|--------|
164
- | Update | Update bot settings | PUT |
151
+ Both nodes have `usableAsTool: true` — they can be used as tools for AI Agent nodes in n8n.
165
152
 
166
- ### Status
153
+ ### Error Handling
167
154
 
168
- | Operation | Description | Method |
169
- |-----------|-------------|--------|
170
- | Get Profile | Get profile | GET |
171
- | Get Status | Get status | GET |
172
- | Update Status | Update status | PUT |
173
- | Delete Status | Delete status | DELETE |
174
-
175
- ### Thread
176
-
177
- | Operation | Description | Method |
178
- |-----------|-------------|--------|
179
- | Create Thread | Create thread | POST |
180
- | Get Thread | Get thread | GET |
181
-
182
- ### Reactions
183
-
184
- | Operation | Description | Method |
185
- |-----------|-------------|--------|
186
- | Add Reaction | Add reaction | POST |
187
- | Delete Reaction | Delete reaction | DELETE |
188
- | Get Reactions | Get reactions | GET |
155
+ - **5xx/429 retry** exponential backoff with jitter, respects `Retry-After` header (up to 5 attempts)
156
+ - **continueOnFail** — supported on all operations
157
+
158
+ ## v1 Compatibility
159
+
160
+ Version 2 is fully backward compatible with v1. Existing v1 workflows continue to work without modification.
161
+
162
+ The node uses the **VersionedNodeType** pattern with `defaultVersion: 2`:
163
+
164
+ - Existing nodes keep `typeVersion: 1` with v1 UI and parameter names
165
+ - New nodes get `typeVersion: 2` with cleaner naming and new resources
166
+ - A shared router translates v1 names to v2 at runtime
167
+
168
+ **Renamed resources:** `reactions` → `reaction`, `status` → `profile`, `customFields` → `customProperty`
169
+
170
+ **Renamed operations:** `send` → `create`, `getById` → `get`, `addReaction` → `create`, etc.
171
+
172
+ **New v2 resources:** Chat Member, Custom Property, Read Member, Link Preview, Search, Chat Export, Security
173
+
174
+ To upgrade a v1 node: delete it, add a new Pachca node (defaults to v2), reconfigure with v2 names. API calls are identical.
189
175
 
190
176
  ## Usage Examples
191
177
 
192
- ### 1. Send a message to a chat
178
+ ### Send a message
193
179
 
194
- ```json
195
- {
196
- "resource": "message",
197
- "operation": "send",
198
- "chatId": 12345,
199
- "content": "Hello! This is an automated message from n8n."
200
- }
201
- ```
180
+ Set **Resource** = Message, **Operation** = Create:
202
181
 
203
- ### 2. Create a chat with settings
182
+ - **Entity ID** chat ID (use searchable dropdown or enter number)
183
+ - **Content** — message text (supports Markdown)
204
184
 
205
- ```json
206
- {
207
- "resource": "chat",
208
- "operation": "create",
209
- "chatName": "New project",
210
- "channel": true,
211
- "public": false
212
- }
213
- ```
185
+ ### Send a message with buttons
214
186
 
215
- ### 3. Update a user
187
+ Set **Resource** = Message, **Operation** = Create, then in **Additional Fields** add **Buttons**:
216
188
 
217
189
  ```json
218
- {
219
- "resource": "user",
220
- "operation": "update",
221
- "userId": 123,
222
- "firstName": "John",
223
- "lastName": "Doe",
224
- "department": "Engineering",
225
- "title": "Senior Developer",
226
- "role": "user",
227
- "listTags": "Backend, Senior",
228
- "customProperties": {
229
- "property": [
230
- {
231
- "id": 1678,
232
- "value": "New York"
233
- }
234
- ]
235
- }
236
- }
190
+ [[{"text": "Approve", "data": "approve"}, {"text": "Reject", "data": "reject"}]]
237
191
  ```
238
192
 
239
- ### 4. Upload a file
193
+ When a user clicks a Data button, the Pachca Trigger node receives a `button_pressed` event with the button's `data` value.
240
194
 
241
- ```json
242
- {
243
- "resource": "file",
244
- "operation": "upload",
245
- "fileSource": "url",
246
- "fileUrl": "https://example.com/document.pdf",
247
- "fileName": "document.pdf"
248
- }
249
- ```
195
+ ### Upload a file and attach to message
250
196
 
251
- ### 5. Workflow: New user notification
197
+ 1. **Pachca** (File > Create) — upload file from URL or binary data, get `key` in response
198
+ 2. **Pachca** (Message > Create) — send message with the file key in the `files` field
252
199
 
253
- 1. **Webhook** receives new user data
254
- 2. **Pachca: Create User** – creates the user in Pachca
255
- 3. **Pachca: Send Message** – sends a welcome message
256
- 4. **Pachca: Create Chat** – creates a personal chat
200
+ ### Search and process results
257
201
 
258
- ## Troubleshooting
202
+ Set **Resource** = Search, **Operation** = Get Many Messages:
259
203
 
260
- ### "Invalid URL" error
204
+ - **Query** search text
205
+ - **Return All** = false, **Limit** = 10
261
206
 
262
- **Problem**: API requests fail due to incorrect URL.
207
+ ### Open a modal form
263
208
 
264
- **Solution**:
265
- 1. Check Base URL in credentials: `https://api.pachca.com/api/shared/v1`
266
- 2. Ensure the access token is valid
267
- 3. Check token permissions
209
+ 1. **Pachca Trigger** — event `Button Pressed` (provides `trigger_id`)
210
+ 2. **Pachca** (Form > Create) set **Title**, **Trigger ID**, choose builder mode
211
+ 3. **Pachca Trigger** event `Form Submitted` (in a separate workflow)
268
212
 
269
- ### "Request failed with status code 404"
213
+ ### Bot echo workflow
270
214
 
271
- **Problem**: Resource not found.
215
+ 1. **Pachca Trigger** event `New Message`
216
+ 2. **IF** — filter: `message.user_id` ≠ bot ID
217
+ 3. **Pachca** (Message > Create) — echo the message back
272
218
 
273
- **Solution**:
274
- 1. Verify the resource ID
275
- 2. Ensure the token has access to the resource
276
- 3. Confirm the resource exists
219
+ ## Troubleshooting
277
220
 
278
- ### "Request failed with status code 400"
221
+ ### 401 Unauthorized
279
222
 
280
- **Problem**: Invalid request parameters.
223
+ Token is invalid or expired. Check **Access Token** in Credentials. For bot tokens: Bot settings > API tab. For personal tokens: Settings > Automations > API.
281
224
 
282
- **Solution**:
283
- 1. Check required fields
284
- 2. Verify data format
285
- 3. Check API limits (text length, file size)
225
+ ### 403 Forbidden
286
226
 
287
- ### Files not uploading
227
+ Token lacks required scopes for this operation. Check available scopes in your token settings. Admin operations (managing users, tags, security log) require admin-level scopes.
288
228
 
289
- **Problem**: Error when uploading files.
229
+ ### 429 Too Many Requests
290
230
 
291
- **Solution**:
292
- 1. Check that the file URL is accessible
293
- 2. Ensure the file does not exceed size limits
294
- 3. Check file format (supported types)
231
+ Rate limit exceeded (~4 req/sec for messages, ~50 req/sec for other operations). The node retries automatically with exponential backoff. For bulk operations, add a **Wait** node between steps.
295
232
 
296
- ### Node not showing in the list
233
+ ### Webhook not received (Trigger)
297
234
 
298
- **Problem**: Custom node does not appear in n8n.
235
+ 1. **Bot not in chat** bot only receives events from chats it's a member of
236
+ 2. **Workflow not activated** — click **Activate** in the top right
237
+ 3. **Bot ID missing** — set Bot ID in Credentials for auto-registration, or configure webhook URL manually in bot settings
238
+ 4. **n8n not reachable** — Pachca can't send webhooks to `localhost`. Use a tunnel (ngrok, Cloudflare Tunnel) or deploy to a server with a public IP
299
239
 
300
- **Solution**:
301
- 1. Ensure files are copied to the correct directory
302
- 2. Restart n8n
303
- 3. Check n8n logs for loading errors
240
+ ### Form not opening
304
241
 
305
- ## Support
242
+ `trigger_id` from a `button_pressed` event expires in **3 seconds**. Place the Form > Create node immediately after the Trigger, with no Wait nodes or long operations in between.
306
243
 
307
- ### Getting help
244
+ ### Node not showing in n8n
308
245
 
309
- - **GitHub Issues**: [Create an issue](https://github.com/pachca/n8n-nodes-pachca/issues)
310
- - **Pachca API documentation**: [api.pachca.com](https://api.pachca.com)
311
- - **n8n Community**: [community.n8n.io](https://community.n8n.io)
246
+ 1. Restart n8n after installing the package
247
+ 2. Check n8n logs for loading errors
248
+ 3. Verify the package is in the correct directory (`~/.n8n/nodes/` or `~/.n8n/custom/node_modules/`)
312
249
 
313
- ### Reporting bugs
250
+ ## Support
314
251
 
315
- When reporting a bug please include:
252
+ - **GitHub Issues** [github.com/pachca/openapi/issues](https://github.com/pachca/openapi/issues)
253
+ - **Pachca API docs** — [dev.pachca.com](https://dev.pachca.com)
254
+ - **n8n Community** — [community.n8n.io](https://community.n8n.io)
316
255
 
317
- 1. n8n version
318
- 2. Node version
319
- 3. Problem description
320
- 4. Error logs
321
- 5. Steps to reproduce
256
+ ## Development
322
257
 
323
- ### Contributing
258
+ This node is auto-generated from the OpenAPI specification:
324
259
 
325
- We welcome contributions:
260
+ ```bash
261
+ # Generate node files from OpenAPI
262
+ bun run integrations/n8n/scripts/generate-n8n.ts
326
263
 
327
- 1. Fork the repository
328
- 2. Create a feature branch
329
- 3. Make your changes
330
- 4. Open a Pull Request
264
+ # Run tests
265
+ cd integrations/n8n && npx vitest run
331
266
 
332
- ## License
267
+ # Type check
268
+ cd integrations/n8n && npx tsc --noEmit
333
269
 
334
- MIT License – see the [LICENSE](LICENSE) file for details.
270
+ # Build for distribution
271
+ cd integrations/n8n && npx n8n-node build
335
272
 
336
- ## Versions
273
+ # Full CI check (from repo root)
274
+ npx turbo check
275
+ ```
337
276
 
338
- ### v1.0.0
339
- - Base functionality
340
- - Support for all main Pachca API resources
341
- - File upload
342
- - User and chat management
277
+ See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for architecture, local testing, and adding new endpoints.
343
278
 
344
- ---
279
+ See [docs/CONTRIBUTORS.md](docs/CONTRIBUTORS.md) for project structure and contribution guidelines.
280
+
281
+ ## License
345
282
 
346
- **Made with ❤️ for the n8n and Pachca community**
283
+ MIT
@@ -1,7 +1,11 @@
1
- import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class PachcaApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
+ icon: {
6
+ readonly light: "file:pachca.svg";
7
+ readonly dark: "file:pachca.dark.svg";
8
+ };
5
9
  documentationUrl: string;
6
10
  properties: INodeProperties[];
7
11
  authenticate: IAuthenticateGeneric;
@@ -5,53 +5,48 @@ class PachcaApi {
5
5
  constructor() {
6
6
  this.name = 'pachcaApi';
7
7
  this.displayName = 'Pachca API';
8
- this.documentationUrl = 'https://crm.pachca.com/dev/getting-started/requests-and-responses/';
8
+ this.icon = { light: 'file:pachca.svg', dark: 'file:pachca.dark.svg' };
9
+ this.documentationUrl = 'https://dev.pachca.com/api/authorization';
9
10
  this.properties = [
11
+ {
12
+ displayName: 'Base URL',
13
+ name: 'baseUrl',
14
+ type: 'string',
15
+ default: 'https://api.pachca.com/api/shared/v1',
16
+ description: 'Base URL of the Pachca API. Change only for on-premise installations or API proxies.',
17
+ },
10
18
  {
11
19
  displayName: 'Access Token',
12
20
  name: 'accessToken',
13
21
  type: 'string',
14
22
  typeOptions: { password: true },
15
23
  default: '',
16
- description: 'Access token for Pachca API. Can be obtained in developer settings.',
17
24
  },
18
25
  {
19
- displayName: 'Base URL',
20
- name: 'baseUrl',
21
- type: 'string',
22
- default: 'https://api.pachca.com/api/shared/v1',
23
- description: 'Base URL for Pachca API',
26
+ displayName: 'Bot ID',
27
+ name: 'botId',
28
+ type: 'number',
29
+ default: 0,
30
+ description: 'Bot ID for automatic webhook registration (found in bot settings). Leave empty to auto-detect from token. Only needed for Pachca Trigger node.',
31
+ hint: 'Only required when using a bot token with the Pachca Trigger node',
24
32
  },
25
33
  {
26
- displayName: 'Token Type',
27
- name: 'tokenType',
28
- type: 'options',
29
- options: [
30
- {
31
- name: 'Bot Token',
32
- value: 'bot',
33
- description: 'Bot token - access to core API methods',
34
- },
35
- {
36
- name: 'Admin Token',
37
- value: 'admin',
38
- description: 'Admin token - access to user and tag management',
39
- },
40
- {
41
- name: 'Owner Token',
42
- value: 'owner',
43
- description: 'Owner token - full access including export',
44
- },
45
- ],
46
- default: 'bot',
47
- description: 'Token type determines available API methods',
34
+ displayName: 'Webhook Signing Secret',
35
+ name: 'signingSecret',
36
+ type: 'string',
37
+ typeOptions: { password: true },
38
+ default: '',
39
+ description: 'Used to verify incoming webhook requests from Pachca. Found in bot settings under the Webhook section.',
40
+ hint: 'Only required when using the Pachca Trigger node',
48
41
  },
49
42
  {
50
- displayName: 'User ID',
51
- name: 'userId',
52
- type: 'number',
43
+ displayName: 'Webhook Allowed IPs',
44
+ name: 'webhookAllowedIps',
45
+ type: 'string',
53
46
  default: '',
54
- description: 'User/bot ID that owns the token (optional)',
47
+ description: 'Comma-separated list of IP addresses allowed to send webhooks. Pachca sends from 37.200.70.177. Leave empty to allow all.',
48
+ placeholder: '37.200.70.177',
49
+ hint: 'Only used with the Pachca Trigger node',
55
50
  },
56
51
  ];
57
52
  this.authenticate = {
@@ -65,9 +60,11 @@ class PachcaApi {
65
60
  this.test = {
66
61
  request: {
67
62
  baseURL: '={{$credentials.baseUrl}}',
68
- url: '/profile',
63
+ url: '/oauth/token/info',
64
+ method: 'GET',
69
65
  },
70
66
  };
71
67
  }
72
68
  }
73
69
  exports.PachcaApi = PachcaApi;
70
+ //# sourceMappingURL=PachcaApi.credentials.js.map