Actions2
Overview
This node performs web and image searches using the Google Custom Search API. It allows users to query Google's search engine programmatically within an n8n workflow, retrieving relevant web pages or images based on a specified search query.
Common scenarios where this node is beneficial include:
- Automating content discovery by searching for recent articles or blog posts.
- Gathering images related to a topic for marketing or design workflows.
- Filtering search results by domain or language to tailor data collection.
- Integrating search capabilities into larger automation pipelines without manual intervention.
For example, a user could automate monitoring news about a specific company by running a web search daily and processing the results further in the workflow.
Properties
| Name | Meaning |
|---|---|
| Operation | Choose between "Web Search" (search for web pages) or "Image Search" (search for images). |
| Query | The search query string to look up. |
| Return All | Whether to return all available results (up to 10) or limit the number of results returned. |
| Limit | Maximum number of results to return when "Return All" is false; valid values are 1 to 10. |
| Options | Additional optional parameters: |
| - Safe Search | Filter results by safe search level: Off, Medium, or High. |
| - Site Search | Limit search results to a specific domain (e.g., example.com). |
| - Language | Restrict results to a specific language: English, Italian, French, German, or Spanish. |
Output
The node outputs an array of JSON objects representing individual search results. Each result includes:
title: The title of the search result.link: The URL of the result.snippet: A short description or snippet from the page.displayLink: The display version of the link (usually the domain).image(only for image search results): An object containing:url: Thumbnail URL of the image.height: Height of the thumbnail.width: Width of the thumbnail.
If no results are found for a query, the output contains a single JSON object with a message indicating no results were found.
In case of errors during execution, error messages are included in the output if the node is configured to continue on failure.
Dependencies
- Requires a valid Google Custom Search API key and a Custom Search Engine ID.
- The node uses the Google Custom Search REST API endpoint:
https://www.googleapis.com/customsearch/v1. - The API key and Custom Search Engine ID must be provided via credentials configured in n8n.
- No additional external dependencies beyond the standard HTTP client library bundled with n8n.
Troubleshooting
- Empty Query Error: If the search query is empty or only whitespace, the node throws an error stating "Search query cannot be empty." Ensure the query parameter is properly set.
- API Credential Issues: Errors such as missing API key or Custom Search Engine ID will cause credential test failures. Verify that both are correctly configured.
- API Rate Limits: The node tracks queries per day but does not handle quota exhaustion explicitly. Exceeding Google API limits may result in errors returned from the API.
- No Results Found: When no search results match the query, the node returns a message indicating no results rather than failing.
- Error Messages from API: If the Google API returns an error, the node surfaces the error message. Common causes include invalid API keys, incorrect Custom Search Engine IDs, or malformed requests.
- To resolve most issues, verify API credentials, ensure the query is valid, and check Google API usage quotas.