AutomationFlowsSocial Media › Automated Breaking News Headlines with Llama3, Google Search and X Posting

Automated Breaking News Headlines with Llama3, Google Search and X Posting

ByAfnan @sky-twinclouds on n8n.io

This n8n workflow automates the process of finding, summarizing, and posting breaking news headlines on X (formerly Twitter). It combines Google Custom Search for finding the latest news articles with Groq's LLaMA 3 model to generate short, engaging headlines — complete with…

Cron / scheduled trigger★★★★☆ complexity8 nodesTwitterHTTP Request
Social Media Trigger: Cron / scheduled Nodes: 8 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #4971 — we link there as the canonical source.

This workflow follows the HTTP Request → Twitter recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "1nKNN0OWmO90VSd0",
  "name": "Free_Auto_Post_Latest_Breaking_News_Content_Using_Groq_+_Google_Search_to_X__Twitter_",
  "tags": [],
  "nodes": [
    {
      "id": "62da7cc5-ea1d-47a0-b626-3ed6fb18e761",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1580,
        140
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 5,
              "triggerAtMinute": "={{Math.floor(Math.random() * 60)}}\n"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eb57a9d0-e0de-4d3d-adcf-d19e28a7e92e",
      "name": "Post to X",
      "type": "n8n-nodes-base.twitter",
      "position": [
        680,
        140
      ],
      "parameters": {
        "text": "={{ $json.choices[0].message.content }}",
        "additionalFields": {}
      },
      "credentials": {
        "twitterOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "765d5be9-5b2c-445b-bf3d-0242d293276f",
      "name": "Groq AI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        140
      ],
      "parameters": {
        "url": "https://api.groq.com/openai/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"llama3-70b-8192\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a social media assistant. Your task is to write a short, news-style headline for a given article title and link. Use exactly this format: <headline> <link>. Be objective and precise. Max 200 characters total.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"{{ $('Function').item.json.prompt.replace(/\\n/g, '\\\\n') }}\"\n}\n  ],\n  \"temperature\": 0.7,\n  \"top_p\": 0.95,\n  \"max_tokens\": 200,\n  \"presence_penalty\": 0,\n  \"frequency_penalty\": 0.4\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "groqApi"
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "31a5bd1c-7fc1-4de8-9c9f-d345d6fede6f",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -360,
        140
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/customsearch/v1?key={{ $json.google_api_key }}&cx={{ $json.google_cx }}?q{{ $node[\"Build Query\"].json[\"query\"] }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7fa6e3e8-1ebb-45c3-8f3b-d3a8df4ae6e4",
      "name": "Function",
      "type": "n8n-nodes-base.code",
      "position": [
        -40,
        140
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const results = item.json.items || [];\n  if (results.length === 0) {\n    throw new Error(\"No search results found\");\n  }\n\n  const top = results[0];\n  item.json.headline = top.title;\n  item.json.url = top.link;\n  item.json.articleTitle = top.title;\n  item.json.articleURL = top.link;\n  item.json.prompt = `Write a short, objective headline (max 120 characters) for the following article, and append 1\u20132 relevant hashtags. Format: <headline> <link> <hashtags>. Title: ${top.title} Link: ${top.link}`;\n\n\n  return item;\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8c093688-de7a-4af7-a053-0e029c910e6f",
      "name": "Google Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -640,
        140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e7d18eb2-7e33-4a4b-8c8b-4eccf2fbcbb3",
              "name": "google_api_key",
              "type": "string",
              "value": "REPLACE_WITH_YOUR_KEY"
            },
            {
              "id": "d59607c2-f942-4f78-968a-42ad57b62eed",
              "name": "google_cx",
              "type": "string",
              "value": "REPLACE_WITH_YOUR_CX"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "542a21f1-78d2-4799-a922-bea3f9fa192b",
      "name": "Set Topic",
      "type": "n8n-nodes-base.set",
      "position": [
        -1200,
        140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f7399b2d-4e42-4ea4-8eed-0fa9fe6b1fcf",
              "name": "topic",
              "type": "string",
              "value": "AI"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1da710ec-770b-4c6c-b0ad-33af5f58d6d5",
      "name": "Build Query",
      "type": "n8n-nodes-base.set",
      "position": [
        -980,
        140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8f4dec98-f070-47e3-9935-e99c60fd4cdf",
              "name": "query",
              "type": "string",
              "value": "={{ \"latest \" + $node[\"Set Topic\"].json[\"topic\"] + \" news\" }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d84ce1e7-87ab-427b-afe5-4e2aeca0664a",
  "connections": {
    "Groq AI": {
      "main": [
        [
          {
            "node": "Post to X",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Groq AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Topic": {
      "main": [
        [
          {
            "node": "Build Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Query": {
      "main": [
        [
          {
            "node": "Google Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Config": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Topic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow automates the process of finding, summarizing, and posting breaking news headlines on X (formerly Twitter). It combines Google Custom Search for finding the latest news articles with Groq's LLaMA 3 model to generate short, engaging headlines — complete with…

Source: https://n8n.io/workflows/4971/ — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Social Media

Social media managers, creators, and brand accounts that rely on retweets for reach but want an automated, hands-off cleanup after campaigns to keep profiles tidy and on-brand.

HTTP Request, Twitter, Slack +1
Social Media

This workflow monitors brand mentions across multiple platforms (Twitter/X, Reddit, News) and automatically detects reputation crises based on sentiment analysis and trend detection. Multi-platform mo

Twitter, Reddit, HTTP Request +3
Social Media

Creator: Summer Chang

HTTP Request, Notion, Twitter
Social Media

FootballAnalytics AI Brain Workflow. Uses httpRequest, twitter. Scheduled trigger; 10 nodes.

HTTP Request, Twitter
Social Media

Symcio · SDG1 Poverty Digest. Uses httpRequest, linkedIn, twitter. Scheduled trigger; 6 nodes.

HTTP Request, LinkedIn, Twitter