Back to Catalog

Templates by David Roberts

Chat with a database using AI

This workflow allows you to ask questions about data stored in a database using AI. To use it, you'll need an OpenAI API key (although you could also swap in a model from another service). Supported databases: Postgres MySQL SQLite The workflow uses n8n's embedded chat, but you could also modify it to work with a chat service such as Slack, MS Teams or WhatsApp. Note that to use this template, you need to be on n8n version 1.19.4 or later.

David RobertsBy David Roberts
213058

AI chat with any data source (using the n8n workflow tool)

This AI agent can access data provided by another n8n workflow. Since that workflow can be used to retrieve any data from any service, this template can be used give an agent access to any data. Note that to use this template, you need to be on n8n version 1.19.4 or later.

David RobertsBy David Roberts
44324

OpenAI assistant with custom tools

This workflow shows how you can get your OpenAI assistant to call an n8n workflow as a tool. Since you can put almost any functionality in an n8n workflow, this means you can give your assistant access to almost any data source. Note that to use this template, you need to be on n8n version 1.19.4 or later.

David RobertsBy David Roberts
14437

Use any LangChain module in n8n (with the LangChain code node)

LangChain is a framework for building AI functionality that users large language models. By leveraging the functionality of LangChain, you can write even more powerful workflows. This workflow shows how you can write LangChain code within n8n, including importing LangChain modules. The workflow itself produces a summary of a YouTube video, when given the video's ID. Note that to use this template, you need to be on n8n version 1.19.4 or later.

David RobertsBy David Roberts
12616

Translate audio using AI

Overview This workflow takes some French text, and translates it into spoken audio. It then transcribes that audio back into text, translates it into English and generates an audio file of the English text. To do so, it uses ElevenLabs (which has a free tier) and OpenAI. Setup These steps should only take a few minutes: In ElevenLabs, add a voice to your voice lab and copy its ID. Add it to the 'Set voice ID' node Get your ElevenLabs API key (click your name in the bottom-left of ElevenLabs and choose ‘profile’) In the 'Generate French audio' node, create a new header auth cred. Set the name to xi-api-key and the value to your API key In the 'credential' field of the 'Transcribe audio' node, create a new OpenAI cred with your OpenAI API key Run the workflow by clicking the orange button at the bottom of the canvas

David RobertsBy David Roberts
10812

Send a message with an inline embedded image with Gmail

The built-in Gmail node doesn't yet support embedding images within the body of the email, but you can pull this off using the HTTP node, and this template shows you how. Requirements A Gmail account How it works The workflow downloads an image, converts it into the format that the Gmail API expects (base64), packages it into a multipart MIME email and uses the HTTP node to send it.

David RobertsBy David Roberts
3724

Evaluation metric example: RAG document relevance

AI evaluation in n8n This is a template for n8n's evaluation feature. Evaluation is a technique for getting confidence that your AI workflow performs reliably, by running a test dataset containing different inputs through the workflow. By calculating a metric (score) for each input, you can see where the workflow is performing well and where it isn't. How it works This template shows how to calculate a workflow evaluation metric: retrieved document relevance (i.e. whether the information retrieved from a vector store is relevant to the question). The workflow takes a question and checks whether the information retrieved to answer it is relevant. To run this workflow, you need to insert documents into a vector data store, so that they can be retrieved by the agent to answer questions. You can do this by running the top part of the workflow once. The main workflow works as follows: We use an evaluation trigger to read in our dataset It is wired up in parallel with the regular trigger so that the workflow can be started from either one. More info We make sure that the agent outputs the list data from the tools that it used If we’re evaluating (i.e. the execution started from the evaluation trigger), we calculate the relevance metric using AI to compare the retrieved documents with the question We pass this information back to n8n as a metric If we’re not evaluating we avoid calculating the metric, to reduce cost

David RobertsBy David Roberts
3539

Access execution data from an error workflow

Sometimes you want to take a different action in your error workflow based on the data that was flowing through it. This template illustrates how you can do that (more specifically, how you can retrieve the data of a webhook node). How it works Use the 'n8n' node to fetch the data of the failed execution Parse that data to find webhook nodes and extract the data of the one that was executed

David RobertsBy David Roberts
2163

Create Linear tickets from Notion content

This workflow allows you to define multiple tickets/issues in a Notion page, then easily import them into Linear. Why is it useful? We use this workflow internally at n8n for collaboration between Product and Engineering teams: Engineering needs all work to be in our ticketing system (Linear) in order to keep track of it Product prefers to review features in Notion. This is because it and can be used to dump all your thoughts and organise them into themes afterwards, plus it better supports rich content like videos Features Supports rich formatting (bullets, images, videos, links, etc.) Keeps links between the Notion and Linear version, in case you need to refer back Allows you to assign each issue to a team member in the Notion definition Avoids importing the same issues twice if you run it again on the same page (meaning you can issues incrementally) You can see an example of the required format of the Notion page here.

David RobertsBy David Roberts
2034

Evaluation metric example: categorization

AI evaluation in n8n This is a template for n8n's evaluation feature. Evaluation is a technique for getting confidence that your AI workflow performs reliably, by running a test dataset containing different inputs through the workflow. By calculating a metric (score) for each input, you can see where the workflow is performing well and where it isn't. How it works This template shows how to calculate a workflow evaluation metric: whether a category matches the expected one. The workflow takes support tickets and generates a category and priority, which is then compared with the correct answers in the dataset. We use an evaluation trigger to read in our dataset It is wired up in parallel with the regular trigger so that the workflow can be started from either one. More info Once the category is generated by the agent, we check whether it matches the expected one in the dataset Finally we pass this information back to n8n as a metric

David RobertsBy David Roberts
1393

Evaluation metric example: Check if tool was called

AI evaluation in n8n This is a template for n8n's evaluation feature. Evaluation is a technique for getting confidence that your AI workflow performs reliably, by running a test dataset containing different inputs through the workflow. By calculating a metric (score) for each input, you can see where the workflow is performing well and where it isn't. How it works This template shows how to calculate a workflow evaluation metric: whether a specific tool was called by an agent. We use an evaluation trigger to read in our dataset It is wired up in parallel with the regular trigger so that the workflow can be started from either one. More info We make sure that the agent outputs the list of tools that it used We then check whether the expected tool (from the dataset) is in that list Finally we pass this information back to n8n as a metric

David RobertsBy David Roberts
1139
All templates loaded