Getting Started with ChatGPT: 5 Simple Workflows

5 simple workflows to get started with ChatGPT in n8n

Getting StartedBeginner 12 min

Getting Started with ChatGPT: 5 Simple Workflows

5 simple workflows to get started with ChatGPT in n8n

By Eduard Parsadanyan
2024
ChatGPTAIWorkflowsOpenAIAutomation

Overview

Learn how to integrate ChatGPT into your n8n workflows with 5 practical examples. This tutorial covers text processing, role-based interactions, prompt chaining, code generation, and multimodal AI capabilities using OpenAI's GPT models.

What You'll Learn

This tutorial introduces fundamental concepts for working with ChatGPT in n8n, including prompt engineering, prompt chaining, and multimodal AI interactions.

  • Set up OpenAI credentials in n8n
  • Understand prompt engineering basics
  • Chain multiple AI models together
  • Generate code with AI assistance
  • Combine text, image, and audio AI models

Prerequisites

  • n8n instance (cloud or self-hosted)
  • OpenAI API account
  • OpenAI API key and Organization ID
  • Basic understanding of AI concepts

Setup: Configure OpenAI Credentials

Before building workflows, configure your OpenAI credentials in n8n.

  • Go to OpenAI platform and create API key
  • Copy your Organization ID
  • In n8n, go to Settings > Credentials
  • Add new OpenAI credential
  • Paste API key and Organization ID
  • Test connection

Workflow 1: Basic Text Processing

Start with simple text summarization and translation tasks using GPT-3.

text
Prompt: Summarize the following text in 2-3 sentences:

{{$json.text}}

Translation Example

text
Prompt: Translate the following text to Spanish:

{{$json.text}}

Provide only the translation without explanations.

Workflow 2: Role-Based ChatGPT Interactions

Configure system and user message roles to customize AI behavior.

json
{
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that adds relevant emojis to every response. Be cheerful and friendly."
    },
    {
      "role": "user",
      "content": "{{$json.userMessage}}"
    }
  ],
  "model": "gpt-3.5-turbo",
  "temperature": 0.7
}

System Role Examples

  • Code reviewer: 'You are an expert code reviewer. Analyze code for bugs and improvements.'
  • Technical writer: 'You are a technical documentation specialist. Explain complex topics simply.'
  • Data analyst: 'You are a data analyst. Interpret data and provide insights.'
  • Creative writer: 'You are a creative storyteller. Write engaging narratives.'

Workflow 3: Prompt Chaining

Connect multiple AI models to create sophisticated workflows. Generate image prompts from text summaries.

  • Node 1: ChatGPT summarizes input text
  • Node 2: ChatGPT converts summary to DALL-E prompt
  • Node 3: DALL-E generates image from prompt
  • Result: Cover image based on text content

Prompt Chaining Example

text
Step 1 - Summarization:
"Summarize this article in one paragraph: {{$json.article}}"

Step 2 - Image Prompt Generation:
"Convert this summary into a detailed image prompt for DALL-E. Include style, mood, colors, and composition: {{$node.ChatGPT1.json.output}}"

Step 3 - Image Generation:
DALL-E prompt: "{{$node.ChatGPT2.json.output}}"

Workflow 4: Code Generation

Use ChatGPT to generate HTML, SVG, JavaScript, and other code snippets.

text
Prompt: Generate an HTML form with the following fields:
- Name (text input)
- Email (email input)
- Message (textarea)
- Submit button

Include basic CSS styling to make it look professional. Provide only the code without explanations.

Code Generation Best Practices

  • Be specific about programming language and framework
  • Specify code style preferences (comments, formatting)
  • Request error handling and edge case coverage
  • Ask for code explanation separately if needed
  • Test generated code before using in production
  • Use lower temperature (0.2-0.3) for more predictable results

Workflow 5: Multimodal Interactions

Combine multiple AI models: transcribe audio with Whisper, then generate related images.

  • Upload audio file to workflow
  • Use Whisper model to transcribe speech to text
  • Pass transcript to ChatGPT for processing
  • Generate image prompt from text
  • Create image with DALL-E
  • Output: Text transcript and related image

Multimodal Workflow Configuration

json
// Whisper Configuration
{
  "operation": "transcribe",
  "file": "{{$binary.audio}}",
  "model": "whisper-1",
  "language": "en"
}

// ChatGPT Processing
{
  "prompt": "Create a visual description based on this transcript: {{$json.text}}"
}

// DALL-E Generation
{
  "prompt": "{{$json.description}}",
  "size": "1024x1024"
}

Key Insights

  • AI models are powerful but require human supervision
  • Prompt engineering is an emerging skill worth developing
  • Temperature affects creativity: lower = consistent, higher = creative
  • Token limits vary by model (check OpenAI documentation)
  • Costs accumulate with usage - monitor your spending
  • Always validate AI output before using in production

Practical Applications

  • Knowledge base creation and maintenance
  • Automated content generation for blogs
  • Code assistance and review
  • Multilingual communication and translation
  • Data analysis and insights generation
  • Customer support automation

Conclusion

These 5 workflows demonstrate the flexibility and power of integrating ChatGPT into n8n. Start with simple text processing, then gradually explore advanced techniques like prompt chaining and multimodal interactions. Remember that AI is a tool to augment human capabilities, not replace human judgment.

Next Steps

  • Explore n8n's OpenAI workflow templates
  • Experiment with different AI models (GPT-4, Claude, etc.)
  • Build custom workflows for your specific use cases
  • Join n8n community to share and learn
  • Study prompt engineering techniques
  • Monitor API costs and optimize usage