n8n Use Cases

Below are the ways I have been using n8n to get work done.

Book a time.

10,000 email in your inbox

Regain control of your Gmail InBox.

Processing 10,000 emails takes about 5 hours and costs $95.00 USD.

We need to set up OAuth access to your InBox.

Your Inbox will be moved and organized into a YEAR’S folder, with subfolders for each year and type folders for Work, Play, Junk, and Other. (e.g., YEARS/2025/Work, YEARS/2024/Play, etc).

managing Users

  1. Create a Google form for staff to apply for an email address/
  2. Create an auto spreadsheet from this form.
  3. Let N8N have access to this form.
  4. Run N8N.
    1. Staff User is created.
    2. Staff User is sent a login email
    3. Staff User is set up on your website

Setting up Google API

Before you can do any work with Google and N8N, you need to set up your APIs.

One-on-One Online

We provide one on one training, best done if you have a website with us.

Please make sure TeamViewer is installed.

Choose a time that suits you.

These times are from 2 PM to 5 PM Hawaii Time; you will see them in your Browser in your time zone.
You can book up to a day before.

Let’s partner.

Let me know what it is you would like to do.

Email address

tony@ainet.biz

Granting OAUTH access to your INBOX aND mORE

Have TeamViewer installed.

How to Set Up Google OAuth in n8n (using a Gmail account)

You must create a Google Cloud project and generate OAuth credentials. Here’s how:

1. Create a Google Cloud Project

  1. Go to Google Cloud Console:
    https://console.cloud.google.com
  2. Sign in with your gmail.com account.
  3. Click Select Project → New Project.
  4. Give it any name → Create.

This is most likely where you want to get us involved.


2. Enable the required APIs

Depending on what you want to connect (Gmail, Drive, Sheets, etc.):

  1. In the left menu, go to APIs & Services → Library.
  2. Search and enable:
    • Gmail API
    • Google Sheets API
    • Google Docs API
    • Google Slides API
    • Google Calendar API
    • Google Business API x4
    • Google Drive API x2
    • Google Maps & Geocoding API x3
    • Google Natural Language API
    • Google Cloud Storage API
    • Google Admin API
    • Google Analytics Admin API
    • Google Gemini API (DO NOT TURN ON)
    • (Enable whichever you plan to use with n8n)


3. Configure OAuth Consent Screen

  1. Go to APIs & Services → OAuth Consent Screen
  2. Choose External (since you’re using a regular Gmail account)
  3. Fill:
    • App name (anything)
    • User support email
    • Developer email
  4. Scopes:
    Add only what you need, e.g.:
    • …/auth/gmail
    • …/auth/drive
    • …/auth/spreadsheets
  5. Test users:
    Add your gmail.com email.
  6. Save.

4. Create OAuth Client ID

  1. Go to Credentials → Create Credentials → OAuth client ID
  2. Application type: Web application
  3. Add Authorized redirect URIs:

IMPORTANT — FOR n8n

If you’re using n8n Cloud (their hosted service):

https://api.n8n.io/oauth2/callback 

If you’re self-hosting n8n at a domain, use:

https://your-domain.com/rest/oauth2-credential/callback

If you’re running local n8n on default port:

http://localhost:5678/rest/oauth2-credential/callback

  1. Save → Google gives you:
    • Client ID
    • Client Secret

5. Add Credentials in n8n

  1. In n8n, open Credentials.
  2. Add Google OAuth2 API.
  3. Enter:
    • Client ID
    • Client Secret
  4. Set the scope (depends on what your workflow needs)
  5. Click Connect / OAuth → Google login will appear
  6. Approve permissions

✔ Done!

n8n is now authorized to work with your Google account.

Cleaning out your InBox

Click Start

Click to start; later, we might schedule this to run every hour until complete.

Get Many Labels & Get Spreadsheet Rows

This is to ensure we have all the required labels and a list of the actual labels.
We could add error checking here if needed.

Merge

This is a useful Node that can perform several tasks and continue only when they are completed.

Counter

I needed a way to run only five cycles during testing, up to 1,000 in production.

Loop

We loop until the counter is full, then break out and send me an email with the number of emails processed.

Get many messages

We only get five messages, as this is what I have been told to work from.

Code

This code is to make the email friendly for the AI to look at.

Basic LLM Chain

This Node allows you to attach processing Nodes, such as a specific AI. In my case, I am connected to Google Gemini, and the credentials here are for the paid version at $0.10 per 1,000,000 tokens.

Add YEAR

The only thing that leaves the Basic LLM Chain is a Word: Work, Play, Junk, or Other.
We also feed in the Message ID from the Get many messages.
And the years that match the date of the Message.
This will give us a folder name like YEARS/2024/Work.

So long as there is no error, we now proceed.

Remove INBOX

Now we remove the INBOX label from the five email messages.

Rince and repeat.

With a counter set to 400, we will process 2,000 emails.

Making a Worker Queue for scheduled Workflows.

Here is the corrected docker-compose.yml.
Key changes made:
  1. Added Worker Service: Since you are using EXECUTIONS_MODE=queue, a dedicated worker is now included to pick up and execute the scheduled tasks.
  2. Fixed Syntax Errors: Corrected the ${SMTP_SENDER} variable syntax (added the missing $).
  3. Network Alignment: Ensured all services are explicitly on the same default network so they can communicate with Redis and Postgres.
  4. Security: Added a placeholder variable for N8N_ENCRYPTION_KEY which is vital for queue mode consistency.

yaml

services:
  traefik:
    image: traefik:v3.6
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - traefik_data:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n:latest
    restart: always
    depends_on:
      - postgres
      - redis
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n-headers.headers.stsSeconds=31536000
      - traefik.http.middlewares.n8n-headers.headers.stsIncludeSubdomains=true
      - traefik.http.middlewares.n8n-headers.headers.stsPreload=true
      - traefik.http.middlewares.n8n-headers.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n-headers.headers.browserXssFilter=true
      - traefik.http.routers.n8n.middlewares=n8n-headers
    environment:
      - NODE_FUNCTION_ALLOW_EXTERNAL=axios,cheerio
      - NODE_FUNCTION_ALLOW_BUILTIN=url,url-parse,whatwg-url,dns/promises
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
      - N8N_USER_MANAGEMENT_JWT_SECRET=${N8N_JWT_SECRET}
      - N8N_EMAIL_MODE=smtp
      - N8N_SMTP_HOST=${SMTP_HOST}
      - N8N_SMTP_PORT=${SMTP_PORT}
      - N8N_SMTP_USER=${SMTP_USER}
      - N8N_SMTP_PASS=${SMTP_PASSWORD}
      - N8N_SMTP_SENDER=${SMTP_SENDER}
      - N8N_SMTP_SSL=${SMTP_SSL}
      - EXECUTIONS_MODE=queue
      - QUEUE_BULL_REDIS_HOST=redis
    volumes:
      - n8n_data:/home/node/.n8n
      - /local-files:/files

  n8n-worker:
    image: n8nio/n8n:latest
    command: worker
    restart: always
    depends_on:
      - n8n
      - redis
      - postgres
    environment:
      - NODE_FUNCTION_ALLOW_EXTERNAL=axios,cheerio
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
      - EXECUTIONS_MODE=queue
      - QUEUE_BULL_REDIS_HOST=redis
    volumes:
      - n8n_data:/home/node/.n8n
      - /local-files:/files

  postgres:
    image: postgres:16-alpine
    restart: always
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - postgres_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    restart: always
    volumes:
      - redis_data:/data

volumes:
  traefik_data:
    external: true
  n8n_data:
    external: true
  postgres_data:
  redis_data:

Use code with caution.

Important Steps Before Restarting:
  1. Generate a JWT Secret: In your .env, make sure N8N_JWT_SECRET is not empty. Run openssl rand -hex 32 in your terminal and paste the result there.
  2. External Volumes: Ensure your external volumes (traefik_data and n8n_data) already exist by running:
    bash
    docker volume create traefik_data
    docker volume create n8n_data
    
    Use code with caution.

  3. Deploy: Run docker compose up -d to apply the changes.

Does the Queue work?

1. The Log Check (Most Direct)
Run the following command to watch the worker’s real-time logs. If it is connected, you should see a “Worker started” message when a scheduled task triggers.
bash
docker logs -f n8n-worker
Use code with caution.

  • What to look for: You should see Worker started execution <ID> and Worker finished execution <ID>.
  • If it fails: You will see errors like Redis connection lost or DB connection refused. 
2. The Redis Queue Check
You can peek inside the Redis container to see if jobs are waiting or being processed. This confirms the main n8n instance is successfully sending tasks to the queue. 
bash
# To see waiting jobs (tasks that haven't been picked up yet)
docker exec -it redis redis-cli LRANGE bull:n8n:waiting 0 -1

# To see active jobs (tasks currently being handled by the worker)
docker exec -it redis redis-cli LRANGE bull:n8n:active 0 -1
Use code with caution.

(Note: If your n8n version is older, the queue name might just be bull:jobs:waiting.) 
3. Enable Health Checks (Recommended) 
You can make the worker report its own status by adding a health check variable to your docker-compose.yml under the n8n-worker environment section:
  • Add this: - QUEUE_HEALTH_CHECK_ACTIVE=true
  • Then check it:
    bash
    docker exec -it n8n-worker wget -qO- http://localhost:5678/healthz/readiness
    
    Use code with caution.

    If it returns 200 OK, the worker’s DB and Redis connections are ready. 

4. UI Worker View
If you ever upgrade to an Enterprise plan, you can view all active workers directly in the n8n UI under Settings > Workers. For the community edition, the logs and Redis checks above are your best bet. 
Pro-tip: To test your fix immediately without waiting for a long schedule, create a Schedule Trigger set to run every 1 minute, activate the workflow, and watch the docker logs -f n8n-worker output. 

Upgrade to the Latest N8N

Go to the terminal of your N8N Server.
Login as Root.

What version of n8n Am I running?

  1. Goto the n8n GUI.
  2. Bottom left hand courner click the ?.
  3. Click “About n8n.

n8n –version

Run each of these commands.

docker compose down
docker compose pull
docker compose up -d

Done.
Now some useful information.

docker compose images
docker images –digests