n8n workflow template · 16 nodes · Postgres
AI Agent to chat with you Search Console Data, using OpenAI and Postgres is a free n8n workflow template that starts when its webhook receives an HTTP request and works with Postgres and OpenAI. It has 16 nodes, 4 of them AI nodes (Postgres Chat Memory, OpenAI Chat Model, Call n8n Workflow Tool and AI Agent). The notes inside the workflow say: “This node is triggered when the AI Agent needs to retrieve the website_list (accessible Search Console properties) or custom_insights based on user data.” To run it, you add your own credentials for Generic OAuth2, HTTP Basic Auth, OpenAI API and Postgres.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
This node is triggered when the AI Agent needs to retrieve the website_list (accessible Search Console properties) or custom_insights based on user data.
This webhook serves as the endpoint for receiving ChatInput data. Ensure that you include
If you're using an interface such as Open WebUI, the sessionId will be generated automatically.
This node sets three fields
This node performs the API call to retrieve data from Search Console.
This node performs the API call to retrieve the list of accessible properties from Search Console.
This tool is used by the AI Agent to
These nodes aggregate the array from the previous step and send it back to the AI Agent through the field named output as response.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
This AI Agent enables you to interact with your Search Console data through a chat interface. Each node is documented within the template, providing sufficient information for setup and usage. You will also need to configure Search Console OAuth credentials.
Follow this n8n documentation to set up the OAuth credentials.
Of course, you'll need to add your client_id and client_secret from the Google Cloud Platform app you created to access your Search Console data.
Since the webhook will be publicly accessible, don’t forget to set up authentication. I’ve used Basic Auth, but feel free to choose the method that best meets your security requirements.
This node configures fields based on the JSON sent by the AI agent
This sub-node utilizes the selected OpenAI Chat Model. You can replace it with any LLM that supports tool calling.
In this template, the default model is gpt-4o, a costly option. If you'd like a more affordable alternative, select gpt4-o-mini, though note that responses may occasionally be of slightly lower quality compared to gpt-4o.
This AI Agent is configured with a system prompt that instructs it to
The AI Agent has a friendly tone and is designed to confirm the user’s data requirements accurately before executing any API requests.
Connect your Postgres credentials and specify a table name to store the chat history. In this template, the default table name is insights_chat_histories, and the context window length is set to 5.
Tip: If you don’t have a Postgres database, you can quickly set one up with Supabase.
These nodes create an array based on the response from the Search Console API.
This node is used to send a response back to the user.
Tip: intermediateSteps are configured, allowing you to use raw data fetched from Search Console to create charts or other visualizations if desired.
The 16 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us