Skip to content

Commit ff2b2de

Browse files
authored
Merge pull request #1 from SearchApi/feat/initial-working-node
Feat/initial working node
2 parents c0fec67 + 149c019 commit ff2b2de

19 files changed

+1605
-577
lines changed

.github/workflows/release.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
3+
name: Release SearchAPI.io n8n nodes
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- uses: pnpm/action-setup@v2
17+
name: Install pnpm
18+
with:
19+
run_install: false
20+
21+
- name: Install Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version-file: "package.json"
25+
cache: pnpm
26+
registry-url: https://registry.npmjs.org
27+
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Publish 🚀
32+
shell: bash
33+
run: pnpm publish packages/components --access public --no-git-checks
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodejs 22.14.0
2+
pnpm 10.9.0

README.md

Lines changed: 92 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,108 @@
11
![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)
22

3-
# n8n-nodes-starter
3+
# n8n SearchApi.io Node
44

5-
This repo contains example nodes to help you get started building your own custom integrations for [n8n](n8n.io). It includes the node linter and other dependencies.
5+
Search the web with [SearchApi.io](https://www.searchapi.io/) directly from your n8n workflows. The node exposes the full power of the `/api/v1/search` endpoint and supports **all engines and query parameters** offered by the service.
66

7-
To make your custom node available to the community, you must create it as an npm package, and [submit it to the npm registry](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry).
7+
> **Why SearchApi.io?**\
8+
> Real‑time SERP data from Google, Bing, DuckDuckGo, Yahoo, Yandex and more – no captchas, no proxies, one simple API.
89
9-
## Prerequisites
10+
---
1011

11-
You need the following installed on your development machine:
12+
## Installation
1213

13-
* [git](https://git-scm.com/downloads)
14-
* Node.js and pnpm. Minimum version Node 18. You can find instructions on how to install both using nvm (Node Version Manager) for Linux, Mac, and WSL [here](https://github.com/nvm-sh/nvm). For Windows users, refer to Microsoft's guide to [Install NodeJS on Windows](https://docs.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows).
15-
* Install n8n with:
14+
### Via the n8n UI (recommended)
15+
16+
1. Open **Settings → Community Nodes** inside your self‑hosted n8n instance.
17+
2. Click **Install → Browse** and search for `n8n-nodes-searchapi`.
18+
3. Select the package, accept the risk prompt, and hit **Install**.
19+
20+
### Via the command line
21+
22+
```bash
23+
# inside your n8n installation folder
24+
npm install n8n-nodes-searchapi
25+
# or with pnpm
26+
pnpm add n8n-nodes-searchapi
27+
```
28+
29+
Restart n8n after the install finishes.
30+
31+
> **Compatibility**
32+
>
33+
> - n8n ≥ 1.30.0
34+
> - Node.js ≥ 18
35+
36+
---
37+
38+
## Credentials
39+
40+
1. Sign up at **[SearchApi.io](https://www.searchapi.io/)** and copy your **API Key**.
41+
2. In n8n go to **Credentials → + New Credential → SearchApi**.
42+
3. Paste the key and save.\
43+
The new credential will now appear in the node’s **Credential** dropdown.
44+
45+
---
46+
47+
## Usage
48+
49+
### 1. Drag‑and‑drop UI
50+
51+
1. Add the **SearchApi** node to your workflow.
52+
2. Choose your **Credential** and the **Engine**.
53+
3. Under **Parameters,** click **Add Parameter** for each query string field you need. To determine which fields to add, refer to the engine's documentation.
54+
- **Name**: `q`
55+
- **Value**: `weather new york`
56+
4. Execute the workflow to receive the response as JSON.
57+
58+
### 2. Pass a parameters object (programmatic)
59+
60+
You can also pass a parameters object directly to the node, instead of the UI:
61+
62+
```json
63+
{
64+
"parameters": {
65+
"q": "n8n workflow automation",
66+
"device": "mobile",
67+
"location": "Berlin"
68+
}
69+
}
70+
```
71+
72+
- Feed the object through a **Set** node or any previous node.
1673
```
17-
pnpm install n8n -g
74+
{{$json.parameters}}
1875
```
19-
* Recommended: follow n8n's guide to [set up your development environment](https://docs.n8n.io/integrations/creating-nodes/build/node-development-environment/).
76+
- The node will give preference to the parameters object.
77+
78+
---
79+
80+
## Example workflows
81+
82+
To easily see how to work with SearchApi on n8n, refer to the examples we've prepared. To use them you can download the json file and import on n8n, or you can paste the url for the, you can also copy the contents and paste inside a workflow. Refer to [n8n docs](https://docs.n8n.io/courses/level-one/chapter-6/#exporting-and-importing-workflows_1) on how to import workflows.
83+
84+
- [Youtube video summarization with SearchApi](/examples/searchapi_youtube_transcripts/)
85+
- [Chatbot that searchs the web with SearchApi](/examples/searchapi_chatbot/)
86+
87+
## Output
88+
89+
The node returns the raw JSON received from SearchApi.io. See the [official docs](https://www.searchapi.io/docs/google) for complete schemas.
2090

21-
## Using this starter
91+
---
2292

23-
These are the basic steps for working with the starter. For detailed guidance on creating and publishing nodes, refer to the [documentation](https://docs.n8n.io/integrations/creating-nodes/).
93+
## Troubleshooting
2494

25-
1. [Generate a new repository](https://github.com/n8n-io/n8n-nodes-starter/generate) from this template repository.
26-
2. Clone your new repo:
27-
```
28-
git clone https://github.com/<your organization>/<your-repo-name>.git
29-
```
30-
3. Run `pnpm i` to install dependencies.
31-
4. Open the project in your editor.
32-
5. Browse the examples in `/nodes` and `/credentials`. Modify the examples, or replace them with your own nodes.
33-
6. Update the `package.json` to match your details.
34-
7. Run `pnpm lint` to check for errors or `pnpm lintfix` to automatically fix errors when possible.
35-
8. Test your node locally. Refer to [Run your node locally](https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/) for guidance.
36-
9. Replace this README with documentation for your node. Use the [README_TEMPLATE](README_TEMPLATE.md) to get started.
37-
10. Update the LICENSE file to use your details.
38-
11. [Publish](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) your package to npm.
95+
| Error message | Likely cause | Fix |
96+
| ---------------------------- | ---------------------------- | --------------------------------------------------------------------------- |
97+
| **401 Unauthorized** | Invalid or missing API key | Double‑check the credentials. |
98+
| **400 Bad Request** | Missing required parameter | Verify against SearchApi docs. |
99+
| **429 Too Many Requests** | Rate limit exceeded | Slow down the workflow or [upgrade plan](https://www.searchapi.io/pricing). |
39100

40-
## More information
101+
---
41102

42-
Refer to our [documentation on creating nodes](https://docs.n8n.io/integrations/creating-nodes/) for detailed information on building your own nodes.
103+
## Resources
43104

44-
## License
105+
- **SearchApi.io documentation**[https://www.searchapi.io/](https://www.searchapi.io/docs/google)
106+
- **n8n Community Forum**[https://community.n8n.io](https://community.n8n.io)
107+
- **Community nodes installation** – [https://docs.n8n.io/integrations/community-nodes/installation/](https://docs.n8n.io/integrations/community-nodes/installation/)
45108

46-
[MIT](https://github.com/n8n-io/n8n-nodes-starter/blob/master/LICENSE.md)

credentials/ExampleCredentialsApi.credentials.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

credentials/HttpBinApi.credentials.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import {
2+
IAuthenticateGeneric,
3+
ICredentialType,
4+
INodeProperties,
5+
} from 'n8n-workflow';
6+
7+
export class SearchApi implements ICredentialType {
8+
name = 'searchApi';
9+
displayName = 'SearchApi API';
10+
11+
// Uses the link to this tutorial as an example
12+
// Replace with your own docs links when building your own nodes
13+
documentationUrl = 'https://www.searchapi.io/docs/google';
14+
properties: INodeProperties[] = [
15+
{
16+
displayName: 'API Key',
17+
name: 'apiKey',
18+
type: 'string',
19+
typeOptions: { password: true },
20+
default: '',
21+
required: true,
22+
},
23+
];
24+
authenticate: IAuthenticateGeneric = {
25+
type: 'generic',
26+
properties: {
27+
qs: { api_key: '={{ $credentials.apiKey }}' },
28+
headers: {
29+
"X-SearchApi-Source": "N8N"
30+
}
31+
}
32+
};
33+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## 🤖 AI Agent Web Search using SearchAPI & LLM
2+
3+
### Who is this for?
4+
5+
This workflow is ideal for anyone conducting **online research**, including **students**, **researchers**, **content creators**, and professionals looking for accurate, up-to-date, and verifiable information. It also serves as an excellent foundation for building more sophisticated AI-driven applications.
6+
7+
### What problem does this workflow solve? / Use case
8+
9+
This workflow automates web searches by enabling an AI agent to retrieve and summarize external, verifiable information efficiently, ensuring accuracy through source citations.
10+
11+
### What this workflow does
12+
13+
* Connects an AI agent node to [SearchAPI.io](https://searchapi.io/) as an integrated search tool.
14+
* Empowers the AI agent to perform real-time web searches using various SearchAPI engines (e.g., Google, Bing).
15+
* Allows the AI agent to dynamically determine search parameters based on user interaction, delivering contextually relevant results.
16+
* Ensures responses include clearly cited sources for validation and further exploration.
17+
18+
### Setup
19+
20+
1. **API Configuration**:
21+
22+
* Set your [SearchAPI.io](https://searchapi.io/) credentials in n8n.
23+
* Connect your preferred AI provider (e.g., OpenRouter, ChatGPT) to the AI agent node.
24+
25+
2. **Input Requirements**:
26+
27+
* User inputs queries via chat interaction with the AI agent.
28+
29+
3. **Configure the AI Agent Node**:
30+
31+
* Select the desired search engines from SearchAPI (e.g., Google, Bing).
32+
* Define parameters the agent can adjust for refined searches.
33+
34+
### How to customize this workflow to your needs
35+
36+
* Integrate additional nodes to structure or store search results (e.g., saving to databases, Notion, Google Sheets).
37+
* Extend chatbot capabilities to integrate with messaging platforms (Slack, Discord) or email notifications.
38+
* Adjust search parameters and filters within the AI agent node to tailor information retrieval.
39+
40+
### Example Usage
41+
42+
* **Input**: User asks, "What are the latest developments in AI regulation?"
43+
* **Output**: AI retrieves, summarizes, and cites recent, authoritative articles and news sources from the web.

0 commit comments

Comments
 (0)