AutomationFlowsSocial Media › Twitter Webhook Handler

Twitter Webhook Handler

Twitter Webhook Handler. Webhook trigger; 10 nodes.

Webhook trigger★★★★☆ complexity10 nodes
Social Media Trigger: Webhook Nodes: 10 Complexity: ★★★★☆ Added:

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
{
  "name": "Twitter Webhook Handler",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "twitter-actions",
        "responseMode": "lastNode"
      },
      "id": "webhook-1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "rules": {
          "rules": [
            {
              "value": "post_tweet",
              "output": 0
            },
            {
              "value": "reply",
              "output": 1
            },
            {
              "value": "like",
              "output": 2
            },
            {
              "value": "post_with_image",
              "output": 3
            },
            {
              "value": "reply_with_image",
              "output": 4
            },
            {
              "value": "thread",
              "output": 5
            },
            {
              "value": "quote_tweet",
              "output": 6
            }
          ]
        }
      },
      "id": "switch-1",
      "name": "Route Action",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Post Tweet\nconst text = $json.text;\nif (!text) return { json: { error: 'Missing text' } };\nreturn { json: { success: true, action: 'post_tweet', text } };"
      },
      "id": "code-1",
      "name": "Post Tweet",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        100
      ]
    },
    {
      "parameters": {
        "jsCode": "// Reply\nconst { text, tweetId } = $json;\nif (!text || !tweetId) return { json: { error: 'Missing fields' } };\nreturn { json: { success: true, action: 'reply', text, tweetId } };"
      },
      "id": "code-2",
      "name": "Reply",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        220
      ]
    },
    {
      "parameters": {
        "jsCode": "// Like\nconst { tweetId } = $json;\nif (!tweetId) return { json: { error: 'Missing tweetId' } };\nreturn { json: { success: true, action: 'like', tweetId } };"
      },
      "id": "code-3",
      "name": "Like",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        340
      ]
    },
    {
      "parameters": {
        "jsCode": "// Post with Image\nconst { text, imageUrl } = $json;\nif (!text || !imageUrl) return { json: { error: 'Missing fields' } };\nreturn { json: { success: true, action: 'post_with_image', text, imageUrl } };"
      },
      "id": "code-4",
      "name": "Post with Image",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "// Reply with Image\nconst { text, tweetId, imageUrl } = $json;\nif (!text || !tweetId || !imageUrl) return { json: { error: 'Missing fields' } };\nreturn { json: { success: true, action: 'reply_with_image', text, tweetId, imageUrl } };"
      },
      "id": "code-5",
      "name": "Reply with Image",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        580
      ]
    },
    {
      "parameters": {
        "jsCode": "// Thread\nconst { tweets } = $json;\nif (!tweets || !Array.isArray(tweets) || tweets.length < 2) {\n return { json: { error: 'Need at least 2 tweets' } };\n}\nreturn { json: { success: true, action: 'thread', tweetCount: tweets.length, tweets } };"
      },
      "id": "code-6",
      "name": "Thread",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        700
      ]
    },
    {
      "parameters": {
        "jsCode": "// Quote\nconst { text, tweetId } = $json;\nif (!text || !tweetId) return { json: { error: 'Missing fields' } };\nreturn { json: { success: true, action: 'quote_tweet', text, tweetId } };"
      },
      "id": "code-7",
      "name": "Quote Tweet",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        700,
        820
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "respond-1",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        950,
        460
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Route Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Action": {
      "main": [
        [
          {
            "node": "Post Tweet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Like",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post with Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply with Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Thread",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Quote Tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post Tweet": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Like": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post with Image": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply with Image": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Thread": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quote Tweet": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": []
}
Pro

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

About this workflow

Twitter Webhook Handler. Webhook trigger; 10 nodes.

Source: https://gist.github.com/marox-cyber/5261e4db2ae8bcae5e85ea1d29cdff58 — 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

generación_publicaciones (workflow 3) webhook all platforms decrypt publicar git. Uses dataTable, linkedIn, httpRequest. Webhook trigger; 50 nodes.

Data Table, LinkedIn, HTTP Request
Social Media

This workflow captures buying-signal leads via a webhook (or optionally polls a HubSpot list), generates a personalized LinkedIn intro and follow-up sequence with Twain, and posts the ready-to-send dr

HTTP Request, Slack
Social Media

Twitter Stream Monitor. Uses googleDrive, googleSheets. Webhook trigger; 19 nodes.

Google Drive, Google Sheets
Social Media

Automate your entire Instagram carousel publishing pipeline from a single webhook call. This workflow receives a product collection payload, loops through each slide image, uploads every asset via Upl

HTTP Request, N8N Nodes Uploadtourl, Slack
Social Media

Twitter MCP - Complete Workflow. Uses start, httpRequest. Webhook trigger; 18 nodes.

Start, HTTP Request