@algolia/n8n-nodes-algolia 0.6.0 → 0.8.0

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.
package/README.md CHANGED
@@ -16,108 +16,180 @@ Algolia is a hosted search API that provides search-as-a-service solutions. It o
16
16
 
17
17
  Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
18
18
 
19
+ ## Credentials
20
+
21
+ To use this node, you need to authenticate with Algolia using API credentials.
22
+
23
+ ### Prerequisites
24
+
25
+ 1. [Sign up](https://dashboard.algolia.com/users/sign_up) or [log into](https://dashboard.algolia.com/users/sign_in) your Algolia account
26
+ 2. In your Algolia dashboard, go to [Settings](https://dashboard.algolia.com/account/overview) > [API Keys](https://dashboard.algolia.com/account/api-keys/all)
27
+ 3. Copy your Application ID
28
+ 4. Copy your Admin API Key
29
+ - Required for if you want to manage your API keys from n8n - otherwise the Write API Key should be enough)
30
+
31
+ ![API Keys page](assets/algolia-credentials.png)
32
+
33
+ 5. In n8n, create new Algolia API credentials with:
34
+ - **Application ID**: Your Algolia Application ID
35
+ - **Admin API Key**: Your Algolia Admin API Key
36
+
37
+ ![Credentials page](assets/n8n-credentials.png)
38
+
19
39
  ## Operations
20
40
 
21
41
  This node supports the following operations:
22
42
 
23
43
  <!-- THE FOLLOWING SECTION IS GENERATED BY CI. ANY CHANGES WILL BE OVERRIDDEN -->
24
44
  <!-- OPERATIONS START -->
45
+
25
46
  ### Advanced
26
- - **Get logs** - The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl).
27
- - **Get app task** - Checks the status of a given application task.
47
+
48
+ - **Retrieve log entries** - The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl).
49
+ - **Check application task status** - Checks the status of a given application task.
28
50
 
29
51
  ### Api Keys
30
- - **List api keys** - Lists all API keys associated with your Algolia application, including their permissions and restrictions.
31
- - **Add api key** - Creates a new API key with specific permissions and restrictions.
32
- - **Get api key** - Gets the permissions and restrictions of an API key.
33
- - **Update api key** - Replaces the permissions of an existing API key.
34
- - **Delete api key** - Deletes the API key.
35
- - **Restore api key** - Restores a deleted API key.
52
+
53
+ - **List API keys** - Lists all API keys associated with your Algolia application, including their permissions and restrictions.
54
+ - **Create an API key** - Creates a new API key with specific permissions and restrictions.
55
+ - **Retrieve API key permissions** - Gets the permissions and restrictions of an API key.
56
+ - **Update an API key** - Replaces the permissions of an existing API key.
57
+ - **Delete an API key** - Deletes the API key.
58
+ - **Restore an API key** - Restores a deleted API key.
36
59
 
37
60
  ### Clusters
38
- - **Assign user id** - Assigns or moves a user ID to a cluster.
39
- - **List user ids** - Lists the userIDs assigned to a multi-cluster application.
40
- - **Batch assign user ids** - Assigns multiple user IDs to a cluster.
41
- - **Get top user ids** - Get the IDs of the 10 users with the highest number of records per cluster.
42
- - **Get user id** - Returns the user ID data stored in the mapping.
43
- - **Remove user id** - Deletes a user ID and its associated data from the clusters.
61
+
62
+ - **Assign or move a user ID** - Assigns or moves a user ID to a cluster.
63
+ - **List user IDs** - Lists the userIDs assigned to a multi-cluster application.
64
+ - **Assign multiple userIDs** - Assigns multiple user IDs to a cluster.
65
+ - **Get top user IDs** - Get the IDs of the 10 users with the highest number of records per cluster.
66
+ - **Retrieve user ID** - Returns the user ID data stored in the mapping.
67
+ - **Delete user ID** - Deletes a user ID and its associated data from the clusters.
44
68
  - **List clusters** - Lists the available clusters in a multi-cluster setup.
45
- - **Search user ids** - Since it can take a few seconds to get the data from the different clusters,
46
- - **Has pending mappings** - To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
69
+ - **Search for user IDs** - Since it can take a few seconds to get the data from the different clusters,
70
+ - **Get migration and user mapping status** - To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
47
71
 
48
72
  ### Dictionaries
49
- - **Batch dictionary entries** - Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
73
+
74
+ - **Add or delete dictionary entries** - Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
50
75
  - **Search dictionary entries** - Searches for standard and custom dictionary entries.
51
- - **Get dictionary settings** - Retrieves the languages for which standard dictionary entries are turned off.
52
- - **Set dictionary settings** - Turns standard stop word dictionary entries on or off for a given language.
53
- - **Get dictionary languages** - Lists supported languages with their supported dictionary types and number of custom entries.
76
+ - **Retrieve dictionary settings** - Retrieves the languages for which standard dictionary entries are turned off.
77
+ - **Update dictionary settings** - Turns standard stop word dictionary entries on or off for a given language.
78
+ - **List available languages** - Lists supported languages with their supported dictionary types and number of custom entries.
54
79
 
55
80
  ### Indices
56
- - **Delete index** - Deletes an index and all its settings.
57
- - **Get settings** - Retrieves an object with non-null index settings.
58
- - **Set settings** - Update the specified index settings.
59
- - **Get task** - Checks the status of a given task.
60
- - **Operation index** - Copies or moves (renames) an index within the same Algolia application.
81
+
82
+ - **Delete an index** - Deletes an index and all its settings.
83
+ - **Retrieve index settings** - Retrieves an object with non-null index settings.
84
+ - **Update index settings** - Update the specified index settings.
85
+ - **Check task status** - Checks the status of a given task.
86
+ - **Copy or move an index** - Copies or moves (renames) an index within the same Algolia application.
61
87
  - **List indices** - Lists all indices in the current Algolia application.
62
88
 
63
89
  ### Records
64
- - **Save object** - Adds a record to an index or replaces it.
65
- - **Get object** - Retrieves one record by its object ID.
66
- - **Add or update object** - If a record with the specified object ID exists, the existing record is replaced.
67
- - **Delete object** - Deletes a record by its object ID.
68
- - **Delete by** - This operation doesn't accept empty filters.
69
- - **Clear objects** - Deletes only the records from an index while keeping settings, synonyms, and rules.
70
- - **Partial update object** - Adds new attributes to a record, or updates existing ones.
71
- - **Batch** - Adds, updates, or deletes records in one index with a single API request.
72
- - **Multiple batch** - Adds, updates, or deletes records in multiple indices with a single API request.
73
- - **Get objects** - Retrieves one or more records, potentially from different indices.
90
+
91
+ - **Add a new record (with auto-generated object ID)** - Adds a record to an index or replaces it.
92
+ - **Retrieve a record** - Retrieves one record by its object ID.
93
+ - **Add or replace a record** - If a record with the specified object ID exists, the existing record is replaced.
94
+ - **Delete a record** - Deletes a record by its object ID.
95
+ - **Delete records matching a filter** - This operation doesn't accept empty filters.
96
+ - **Delete all records from an index** - Deletes only the records from an index while keeping settings, synonyms, and rules.
97
+ - **Add or update attributes** - Adds new attributes to a record, or updates existing ones.
98
+ - **Batch indexing operations on one index** - Adds, updates, or deletes records in one index with a single API request.
99
+ - **Batch indexing operations on multiple indices** - Adds, updates, or deletes records in multiple indices with a single API request.
100
+ - **Retrieve records** - Retrieves one or more records, potentially from different indices.
74
101
 
75
102
  ### Rules
76
- - **Get rule** - Retrieves a rule by its ID.
77
- - **Save rule** - If a rule with the specified object ID doesn't exist, it's created.
78
- - **Delete rule** - Deletes a rule by its ID.
79
- - **Save rules** - Create or update multiple rules.
80
- - **Clear rules** - Deletes all rules from the index.
81
- - **Search rules** - Searches for rules in your index.
103
+
104
+ - **Retrieve a rule** - Retrieves a rule by its ID.
105
+ - **Create or replace a rule** - If a rule with the specified object ID doesn't exist, it's created.
106
+ - **Delete a rule** - Deletes a rule by its ID.
107
+ - **Create or update rules** - Create or update multiple rules.
108
+ - **Delete all rules** - Deletes all rules from the index.
109
+ - **Search for rules** - Searches for rules in your index.
82
110
 
83
111
  ### Search
84
- - **Search single index** - Searches a single index and returns matching search results (_hits_).
85
- - **Search** - Sends multiple search requests to one or more indices.
112
+
113
+ - **Search an index** - Searches a single index and returns matching search results as hits.
114
+ - **Search multiple indices** - Sends multiple search requests to one or more indices.
86
115
  - **Search for facet values** - Searches for values of a specified facet attribute.
87
- - **Browse** - Retrieves records from an index, up to 1,000 per request.
116
+ - **Browse for records** - Retrieves records from an index, up to 1,000 per request.
88
117
 
89
118
  ### Synonyms
90
- - **Get synonym** - Retrieves a synonym by its ID.
91
- - **Save synonym** - If a synonym with the specified object ID doesn't exist, Algolia adds a new one.
92
- - **Delete synonym** - Deletes a synonym by its ID.
93
- - **Save synonyms** - If a synonym with the `objectID` doesn't exist, Algolia adds a new one.
94
- - **Clear synonyms** - Deletes all synonyms from the index.
95
- - **Search synonyms** - Searches for synonyms in your index.
119
+
120
+ - **Retrieve a synonym** - Retrieves a synonym by its ID.
121
+ - **Create or replace a synonym** - If a synonym with the specified object ID doesn't exist, Algolia adds a new one.
122
+ - **Delete a synonym** - Deletes a synonym by its ID.
123
+ - **Create or replace synonyms** - If a synonym with the `objectID` doesn't exist, Algolia adds a new one.
124
+ - **Delete all synonyms** - Deletes all synonyms from the index.
125
+ - **Search for synonyms** - Searches for synonyms in your index.
96
126
 
97
127
  ### Vaults
98
- - **Get sources** - Retrieves all allowed IP addresses with access to your application.
99
- - **Replace sources** - Replaces the list of allowed sources.
100
- - **Append source** - Adds a source to the list of allowed sources.
101
- - **Delete source** - Deletes a source from the list of allowed sources.
102
- <!-- OPERATIONS END -->
103
128
 
104
- ## Credentials
129
+ - **List allowed sources** - Retrieves all allowed IP addresses with access to your application.
130
+ - **Replace allowed sources** - Replaces the list of allowed sources.
131
+ - **Add a source** - Adds a source to the list of allowed sources.
132
+ - **Delete a source** - Deletes a source from the list of allowed sources.
133
+ <!-- OPERATIONS END -->
105
134
 
106
- To use this node, you need to authenticate with Algolia using API credentials.
135
+ ## Usage examples
107
136
 
108
- ### Prerequisites
137
+ ### Batch insert into an Algolia Index
109
138
 
110
- 1. Sign up for an [Algolia account](https://www.algolia.com)
111
- 2. Create an application in your Algolia dashboard
139
+ This section demonstrates how to efficiently perform batch inserts into an Algolia index using n8n.
112
140
 
113
- ### Authentication Setup
141
+ Batch operations are ideal for processing large datasets, as they reduce latency and improve data consistency.
114
142
 
115
- 1. In your Algolia dashboard, go to Settings > API Keys
116
- 2. Copy your Application ID
117
- 3. Copy your Admin API Key (required for write operations)
118
- 4. In n8n, create new Algolia API credentials with:
119
- - **Application ID**: Your Algolia Application ID
120
- - **Admin API Key**: Your Algolia Admin API Key
143
+ <div align="center">
144
+
145
+ ![Batch workflow](assets/workflow-1.png)
146
+ <i>Example of a Batch indexing operation workflow</i>
147
+
148
+ </div>
149
+
150
+ **Step-by-step guide:**
151
+
152
+ 1. Add a **webhook node** or a third-party webhook trigger node to initiate your workflow.
153
+
154
+ 2. Utilize a **Code node** (JavaScript or Python) to format your data for the Algolia batch insert operation.
155
+ - If your items already have unique identifiers, assign them to the `objectID` property.
156
+ - If not, Algolia will automatically generate a unique `objectID` when using the `addObject` or `partialUpdateObject` actions.
157
+ - To remove a record, use the `deleteObject` action.
158
+ - For a complete overview of available actions, refer to the [official documentation](https://www.algolia.com/doc/rest-api/search/batch#body-requests).
159
+
160
+ ![Batch workflow](assets/workflow-1-1.png)
161
+
162
+ 3. Add the Algolia node for **Batch indexing operations on one index** and connect it to your data list. As a best practice, ensure that only one item at a time enters this node.
163
+
164
+ ![Batch workflow](assets/workflow-1-2.png)
165
+
166
+ 4. Activate the workflow to begin automated batch indexing.
167
+
168
+ Now, when items are added/deleted from your 3pr-party software, this workflow will make sure your index stays fresh and up to date!
169
+
170
+ _API Rate limitations apply. See https://www.algolia.com/doc/guides/scaling/algolia-service-limits for more details._
171
+
172
+ ### Scheduled Cleanup of Deprecated Synonyms
173
+
174
+ Over time, synonyms in your Algolia index might become outdated or no longer needed. With n8n, you can automate the removal of deprecated or unused synonyms to keep your index clean and relevant.
175
+
176
+ <div align="center">
177
+
178
+ ![Synonym workflow](assets/workflow-2.png)
179
+ <i>Example of a Batch indexing operation workflow</i>
180
+
181
+ </div>
182
+
183
+ **Step-by-step guide:**
184
+
185
+ 1. Use the **Schedule trigger** node to schedule the cleanup to run regularly (daily, weekly, etc.).
186
+ 2. Add the Algolia node to **"Search for synonyms"** in your target index.
187
+ 3. Use a code node to filter synonyms that match your criteria for deprecation or removal (for example, a custom `deprecated` tag or certain naming patterns).
188
+ 4. For each deprecated synonym, add an Algolia node to **"Delete a synonym"** by its ID.
189
+
190
+ This workflow helps ensure your Algolia synonyms stay accurate and up to date.
191
+
192
+ _API Rate limitations apply. See https://www.algolia.com/doc/guides/scaling/algolia-service-limits for more details._
121
193
 
122
194
  ## Compatibility
123
195
 
@@ -126,5 +198,5 @@ This node requires n8n version 1.0.0 or higher and Node.js 20.15 or higher.
126
198
  ## Resources
127
199
 
128
200
  - [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
129
- - [Algolia API documentation](https://www.algolia.com/doc/api-reference/)
201
+ - [Algolia API documentation](https://www.algolia.com/doc/rest-api/search)
130
202
  - [Algolia dashboard](https://www.algolia.com/apps)
@@ -1,41 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- class AlgoliaApi {
6
- constructor() {
7
- this.name = "algoliaApi";
8
- this.displayName = "Algolia API";
9
- this.documentationUrl = "https://www.algolia.com";
10
- this.properties = [
11
- {
12
- displayName: "Application ID",
13
- name: "appId",
14
- type: "string",
15
- required: true,
16
- default: ""
17
- },
18
- {
19
- displayName: "Admin API Key",
20
- name: "adminApiKey",
21
- type: "string",
22
- typeOptions: {
23
- password: true
24
- },
25
- required: true,
26
- default: ""
27
- }
28
- ];
29
- this.authenticate = {
30
- type: "generic",
31
- properties: {
32
- headers: {
33
- "X-Algolia-Application-Id": "={{ $credentials.appId }}",
34
- "X-Algolia-API-Key": "={{ $credentials.adminApiKey }}"
35
- }
36
- }
37
- };
38
- }
39
- }
40
-
41
- exports.AlgoliaApi = AlgoliaApi;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class e{constructor(){this.name="algoliaApi",this.displayName="Algolia API",this.documentationUrl="https://www.algolia.com",this.icon="file:./algolia.svg",this.properties=[{displayName:"Application ID",name:"appId",type:"string",required:!0,default:""},{displayName:"Admin API Key",name:"adminApiKey",type:"string",typeOptions:{password:!0},required:!0,default:""}],this.authenticate={type:"generic",properties:{headers:{"X-Algolia-Application-Id":"={{ $credentials.appId }}","X-Algolia-API-Key":"={{ $credentials.adminApiKey }}"}}}}}exports.AlgoliaApi=e;