AI Influencer Agent

An AI Agent that posts on X based on a pre-defined system prompt, at a specific schedule

beginner
Updated 6/15/2025
social media
X / Twitter

Overview

The difference between people making money on Twitter and those struggling isn't talent or luckβ€”it's having the right system. This AI agent is that system.

Instructions

  1. 1Download or copy the JSON below
  2. 2Import or paste it into your n8n

n8n Workflow Code

{
  "name": "X Influencer Agent",
  "nodes": [
    {
      "parameters": {
        "content": "## Scheduled posting \nWrite a tweet every hour and randomize the minutes that it's posted at to make it seem natural.\n",
        "height": 265,
        "width": 389
      },
      "id": "50c58814-72be-443f-b572-cdd7a83a8609",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "text": "={{ $json.message.content.tweet }}",
        "additionalFields": {}
      },
      "id": "dc30c34b-5ef6-4b92-a864-70b3ca5f8808",
      "name": "Post tweet",
      "type": "n8n-nodes-base.twitter",
      "position": [
        2020,
        120
      ],
      "typeVersion": 2
    },
    {
      "parameters": {},
      "id": "203ebfdb-8137-4ead-9518-53e8c2d0ac67",
      "name": "Trigger posting manually",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        220,
        420
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## Configure influencer profile \nSet your target niche, writing style, and inspiration.\n",
        "height": 265,
        "width": 389
      },
      "id": "2f529e5c-6d25-43bb-9685-e291213eadd0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        0
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## Generate tweet\nGenerate a potentially viral tweet based on your configuration.",
        "height": 265,
        "width": 389
      },
      "id": "651eec36-0103-46ea-89b7-102b44ddb062",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        0
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## Validate tweet\nIf the generated tweet does not meet length constraints, regenerate it.",
        "height": 265,
        "width": 389
      },
      "id": "3ef902a3-ec6d-4763-81b1-efcf8a7eaa13",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        0
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## Post the tweet\nPost the tweet to your X account.",
        "height": 265,
        "width": 389
      },
      "id": "26b1cff1-d8fc-4c12-be20-9911bbf6ecce",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        0
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "0a6ebbb6-4b14-4c7e-9390-215e32921663",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.message.content.tweet.length }}",
              "rightValue": 280
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b6a7cbc2-145d-472a-83f2-1b07ab567c15",
      "name": "Verify tweet constraints",
      "type": "n8n-nodes-base.if",
      "position": [
        1560,
        100
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "content": "## On-demand posting \nWrite a tweet on demand, when you manually run your workflow.\n",
        "height": 265,
        "width": 389
      },
      "id": "878ef9d6-f1b2-4952-9a6f-6e697b5e8c23",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        320
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4-turbo-preview",
          "cachedResultName": "GPT-4-TURBO-PREVIEW"
        },
        "messages": {
          "values": [
            {
              "content": "=You are a successful modern Twitter influencer. Your tweets always go viral. ",
              "role": "system"
            },
            {
              "content": "=You have a specific writing style: {{ $json.style }}",
              "role": "system"
            },
            {
              "content": "=You follow the principles described in your inspiration sources closely and you write your tweets based on that: {{ $json.inspiration }}",
              "role": "system"
            },
            {
              "content": "=You have a very specific niche: {{ $json.niche }}",
              "role": "system"
            },
            {
              "content": "=Answer with the viral tweet and nothing else as a response. Keep the tweet within 280 characters. Current date and time are {{DateTime.now()}}. Add hashtags and emojis where relevant.",
              "role": "system"
            },
            {
              "content": "Write a tweet that is certain to go viral. Take your time in writing it. Think. Use the vast knowledge you have."
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "id": "1d99bb80-a86e-4308-84c5-45990eb8f9b8",
      "name": "Generate tweet content",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        980,
        100
      ],
      "typeVersion": 1,
      "credentials": {
        "openAiApi": {
          "id": "zfaMtaO23pktFzNZ",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "45268b04-68a1-420f-9ad2-950844d16af1",
              "name": "niche",
              "type": "string",
              "value": "Modern Stoicism. You tweet about the greatest stoics, their ideas, their quotes, and how their wisdom applies in today's modern life. You love sharing personal stories and experiences."
            },
            {
              "id": "d95f4a1c-ab1c-4eca-8732-3d7a087f82d8",
              "name": "style",
              "type": "string",
              "value": "All of your tweets are very personal. "
            },
            {
              "id": "1ee088f7-7021-48c0-bcb7-d1011eb0db3d",
              "name": "inspiration",
              "type": "string",
              "value": "Your inspiration comes from tens of books on stoicism, psychology, and how to influence people. Books such as \"Contagious\" by Jonah Bergen, \"How To Be Internet Famous\" by Brendan Cox, \"How to Win Friends and Influence People\" by Dale Carnegie, and \"Influencers and Creators\" by Robert V Kozinets, Ulrike Gretzel, Rossella Gambetti strongly influence the way you write your tweets. "
            }
          ]
        },
        "options": {}
      },
      "id": "fffb9eae-1919-4cf7-9022-c95b6d2158ed",
      "name": "Configure your influencer profile",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        100
      ],
      "typeVersion": 3.3
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "triggerAtMinute": "={{ Math.floor(Math.random() * 60) }}"
            }
          ]
        }
      },
      "id": "594b3966-8b96-47c2-9190-18546ac0233e",
      "name": "Schedule posting every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        220,
        100
      ],
      "typeVersion": 1.1
    }
  ],
  "pinData": {},
  "connections": {
    "Generate tweet content": {
      "main": [
        [
          {
            "node": "Verify tweet constraints",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger posting manually": {
      "main": [
        [
          {
            "node": "Configure your influencer profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify tweet constraints": {
      "main": [
        [
          {
            "node": "Configure your influencer profile",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure your influencer profile": {
      "main": [
        [
          {
            "node": "Generate tweet content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule posting every hour": {
      "main": [
        [
          {
            "node": "Configure your influencer profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "453c26fe-9034-4b38-871a-2926e364ae1c",
  "meta": {
    "instanceId": "d21ead83680689d690a8650e463fc3d233db795a4a97d0a8d8ad1b8ad409fdc5"
  },
  "id": "W708U0znYjNFZOlX",
  "tags": [
    {
      "createdAt": "2025-05-20T15:22:35.984Z",
      "updatedAt": "2025-05-20T15:22:35.984Z",
      "id": "CrEfrJ262kL8QNqe",
      "name": "POSTED"
    },
    {
      "createdAt": "2025-05-20T13:50:55.061Z",
      "updatedAt": "2025-05-20T13:50:55.061Z",
      "id": "mxfXOOd0QdWyCkTB",
      "name": "AI agent"
    }
  ]
}

Need help implementing or selling this?

Get a free consultation and we'll do it together.