Language is powerful! It is how we connect and communicate as humans – it is also how we learn about the world around us. Conversely, although software has undergone significant advancements, computers have always had limitations in their capacity to process language.

However, that trend began to change when language models danced their way onto the deep learning stage and became a thingthese models have evolved from Recurrent Neural Networks(RNNs), Transformers, and in recent times the Generative Pre-trained Transformer(GPT) and more specifically the ChatGPT.

As n8n OpenAI integrations are getting more popular over the last few months, we thought of putting together 6 automation ideas for working with OpenAI node and n8n. Some of these automation ideas would in fact leverage the language model that powers ChatGPT.

To begin, let’s quickly cover the basics of Large Language Models (LLMs).

What are Large Language Models (LLMs)?

Language models in general, at their core, compute the probability of a sequence of words occurring together. Being able to compute probabilities, Language Models can predict the next word in a sequence by trying a bunch of words and returning the sequence with the highest probability – think text auto-completion.

LLMs are fundamentally language models but with one key difference – they’ve been trained with a huge dataset (we are talking hundreds of billions) and they have billions of parameters as well. Basically, they are bigger and in fact, this is what the Large represents in LLM; a large training dataset and huge parameters.

The fact that LLMs have been exposed to such huge training data inherently makes them competent at predictive text generation.

But beyond predictive text generation, these models could be fine-tuned to answer questions – which is what we see with ChatGPT:

Chatgpt
Chatgpt

ChatGPT was developed and is currently maintained by OpenAI – it is essentially a chatbot that is powered by a pre-trained large language model with billions of parameters.

OpenAI, an artificial intelligence research and deployment company, is also responsible for the development of other popular Large Language Models(LLMs) you hear today – think, gpt-3.5-turbo, gpt-4, DALLE.E, and whisper-1. This AI is arguably revolutionizing the way businesses communicate and automate tasks.

Automation ideas with OpenAI node and n8n

Here, we will explore some workflow automation ideas that combine OpenAI with n8n. Some of these workflows actually combine n8n with the OpenAI language model that powers ChatGPT.

Workflow 1: OpenAI-powered tweet generator

Most people these days lack the time to create compelling tweets that could garner lots of engagements. The OpenAI powered tweet generator workflow was created to alleviate this challenge – it uses the OpenAI API to generate tweets to be stored in Airtable for review.

How does it work?

Workflow 1: OpenAI-powered tweet generator
Workflow 1: OpenAI-powered tweet generator
  1. The Code node (Function Item) uses a JavaScript snippet to return a hashtag from a pre-populated array of hashtags.
  2. The HTTP Request node makes a POST request to the OpenAI API. The API returns the generated tweets.
  3. The Set node sets the values you want to store from all the data you get from the API. In this case, it sets values for the hashtag and content for all generated tweets. And this is the data that would be stored in Airtable.
  4. Lastly, the Airtable node appends the generated tweets to an existing table on Airtable.

Workflow 2: Reddit AI digest

The Reddit AI workflow digests mentions of n8n on Reddit that can be sent as a single email or Slack summary each week. The workflow uses OpenAI to classify if a specific Reddit post is really about n8n or not, and then summarize it into a bullet point sentence.

How does it work?

Workflow 2: Reddit AI digest
Workflow 2: Reddit AI digest
  1. The Reddit node gets posts from Reddit that might mention or talk about n8n.
  2. The If and Set nodes work together to filter the most relevant posts (posted in the last 7 days and more than 5 upvotes and is original content).
  3. The Open AI node checks if a filtered post is actually about n8n.
  4. If it is, the post is then categorized with OpenAI.

Workflow 3: Send automated email response with ChatGPT and n8n

This workflow triggers an OpenAI GPT response when an email is received from particular email addresses. The original email and the GPT reply are both stored in a Google Spreadsheet that is automatically created. Any subsequent GPT responses are appended to the same Spreadsheet.

Furthermore, if feedback is provided on any of the GPT responses, it will be logged in the Spreadsheet. This information can be utilized in the future to improve the GPT model.

How does it work?

Workflow 3: Send automated email response with ChatGPT and n8n
Workflow 3: Send automated email response with ChatGPT and n8n

This workflow is essentially a two-in-one workflow. It triggers off from two different nodes and has very different functionality from each trigger.

The flow triggered from the Gmail trigger node labeled On email received is as follows:

  1. The Gmail trigger node extracts the email body from the email and the OpenAI node generates a response from the email body.
  2. The Gmail node, labeled, Send reply to recipient node sends the OpenAI generated response to the recipient.
  3. The Google Sheets node saves the email body and OpenAI response to a Google Sheet. If a sheet does not exist, it will be created.

The flow triggered from the Webhook node labeled On feedback given is as follows:

  1. Triggers off when a feedback link is clicked in the emailed GPT response.
  2. The feedback, either positive or negative, for that specific GPT response is then recorded in the Google Sheet.

Workflow 4: Upload specific Gmail attachments to Google Drive with OpenAI

This workflow reads PDF textual content and sends the text to OpenAI. Attachments of interest will then be uploaded to a specified Google Drive folder. For example, you may wish to send invoices received from an email to an inbox folder in Google Drive for later processing.

How does it work?

Workflow 4: Upload specific Gmail attachments to Google Drive with OpenAI
Workflow 4: Upload specific Gmail attachments to Google Drive with OpenAI
  1. The Gmail trigger node labeled,  On email received, starts this workflow and iterates over the attachments in the email.
  2. The OpenAI node filters out the attachments that do not match the search term set in the Configure node.
  3. The Google Drive node uploads PDF attachments that match the search term to a specific Google Drive folder.

Workflow 5: Company enrichment from website content with ChatGPT and n8n

The company enrichment from website content workflow grabs useful company data like its market, industry, target audience and value proposition by just reading and analyzing the HTML content on the company’s website. It then stores this useful data in a Google Spreadsheet.

How does it work?

Workflow 5: Company enrichment from website content with ChatGPT and n8n
Workflow 5: Company enrichment from website content with ChatGPT and n8n
  1. The Google Sheets node retrieves website URLs from predefined Google Sheets.
  2. The HTTP Request node and the HTML node are combined to extract the content for each website.
  3. The OpenAI node analyzes the content of the web page.
  4. The Google Sheets node updates Google Sheets with the GPT-3 data.

Workflow 6: Email responses categorization from a lead on Lemlist with OpenAI

The Lemlist supercharges your sales workflow by combining n8n with OpenAI to categorize an email response from a lead on Lemlist. In other words, this workflow parses an email response with OpenAI node, and based on the general tone of the email as deduced by the OpenAI node, this workflow is then able to tell whether the client is interested, wants to unsubscribe or is out of office.

How does it work?

Workflow 6: Email responses categorization from a lead on Lemlist with OpenAI
Workflow 6: Email responses categorization from a lead on Lemlist with OpenAI
  1. Triggers off on the Lemlist trigger node labeled,  Lemlist - Lead Replied.
  2. Uses the OpenAI node to analyze the email reply and subsequently categorizes the email( interested, unsubscribe, out of office etc).
  3. Send notifications to Slack, for example.

Wrap up

These are just a few examples of the many use cases for ChatGPT and n8n. And more generally n8n with OpenAI. With their highly versatile and flexible platforms, n8n and OpenAI can be used to automate a wide range of tasks and processes, improving overall efficiency and productivity.

Register your n8n account in the cloud and start automating OpenAI workflows for free! You can also run n8n on your server!