AutomationFlowsSlack & Telegram › AI Code Review on GitHub PRs

AI Code Review on GitHub PRs

Original n8n title: AI Code Reviewer

AI Code Reviewer. Uses githubTrigger, httpRequest, openAi, slack. Event-driven trigger; 5 nodes.

Event trigger★★★★☆ complexityAI-powered5 nodesGithub TriggerHTTP RequestOpenAISlack
Slack & Telegram Trigger: Event Nodes: 5 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the HTTP Request → OpenAI 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
{
  "name": "AI Code Reviewer",
  "nodes": [
    {
      "parameters": {
        "events": [
          "pull_request"
        ],
        "additionalParameters": {
          "action": "opened"
        },
        "options": {}
      },
      "id": "c9d0e1f2-9999-4000-8000-000000000001",
      "name": "GitHub Trigger",
      "type": "n8n-nodes-base.githubTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "owner": "={{ $json.repository.owner.login }}",
        "repository": "={{ $json.repository.name }}",
        "operation": "get",
        "resource": "file",
        "filePath": "",
        "additionalParameters": {},
        "requestOptions": {
          "url": "={{ $json.pull_request.diff_url }}"
        }
      },
      "id": "c9d0e1f2-9999-4000-8000-000000000002",
      "name": "GitHub Get Diff",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        500,
        300
      ],
      "parameters_overwrite": {
        "method": "GET",
        "url": "={{ $json.pull_request.diff_url }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an expert code reviewer. Review the following pull request diff and provide constructive feedback. Focus on:\n\n1. **Bugs & Logic Errors**: Identify potential bugs, edge cases, or logic issues\n2. **Security**: Flag any security vulnerabilities (SQL injection, XSS, exposed secrets, etc.)\n3. **Performance**: Note any performance concerns or optimization opportunities\n4. **Code Quality**: Comment on readability, naming, structure, and adherence to best practices\n5. **Testing**: Suggest missing test cases\n\nFormat your review as:\n## Summary\n<1-2 sentence overview>\n\n## Issues Found\n- :red_circle: **Critical**: <issue>\n- :yellow_circle: **Warning**: <issue>\n- :blue_circle: **Suggestion**: <issue>\n\n## Positive Notes\n- <what was done well>\n\n## Recommended Changes\n1. <specific change>\n\nKeep feedback constructive and actionable. Reference specific line numbers when possible."
            },
            {
              "role": "user",
              "content": "=PR Title: {{ $('GitHub Trigger').item.json.pull_request.title }}\nPR Description: {{ $('GitHub Trigger').item.json.pull_request.body || 'No description provided' }}\nAuthor: {{ $('GitHub Trigger').item.json.pull_request.user.login }}\n\nDiff:\n{{ $json.data ? $json.data.substring(0, 12000) : 'Unable to fetch diff' }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 2048
        }
      },
      "id": "c9d0e1f2-9999-4000-8000-000000000003",
      "name": "OpenAI Review Code",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.6,
      "position": [
        750,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.github.com/repos/{{ $('GitHub Trigger').item.json.repository.full_name }}/issues/{{ $('GitHub Trigger').item.json.pull_request.number }}/comments",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ body: '## :robot: AI Code Review\\n\\n' + $json.text + '\\n\\n---\\n*This review was generated by an AI assistant. Please use your judgment when applying suggestions.*' }) }}",
        "options": {}
      },
      "id": "c9d0e1f2-9999-4000-8000-000000000004",
      "name": "GitHub Post Comment",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1000,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "channel": "#code-reviews",
        "text": "=:mag: *AI Code Review Posted*\n\n*PR:* <{{ $('GitHub Trigger').item.json.pull_request.html_url }}|{{ $('GitHub Trigger').item.json.pull_request.title }}>\n*Author:* {{ $('GitHub Trigger').item.json.pull_request.user.login }}\n*Repository:* {{ $('GitHub Trigger').item.json.repository.full_name }}\n\nAI review has been posted as a comment on the PR.",
        "otherOptions": {}
      },
      "id": "c9d0e1f2-9999-4000-8000-000000000005",
      "name": "Slack Notify",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1250,
        300
      ],
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "GitHub Trigger": {
      "main": [
        [
          {
            "node": "GitHub Get Diff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub Get Diff": {
      "main": [
        [
          {
            "node": "OpenAI Review Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Review Code": {
      "main": [
        [
          {
            "node": "GitHub Post Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub Post Comment": {
      "main": [
        [
          {
            "node": "Slack Notify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null
}

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

AI Code Reviewer. Uses githubTrigger, httpRequest, openAi, slack. Event-driven trigger; 5 nodes.

Source: https://github.com/mlnjsh/n8n-workflows-mega/blob/main/workflows/ai-agents/09-ai-code-reviewer.json — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

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

Slack & Telegram

Splitout Code. Uses googleSheetsTrigger, httpRequest, splitInBatches, googleSheets. Event-driven trigger; 35 nodes.

Google Sheets Trigger, HTTP Request, Google Sheets +2
Slack & Telegram

This workflow is designed for business analysts, market researchers, lead generation specialists, and sales teams who need to gather detailed business intelligence from Google Maps. It's particularly

Telegram, OpenAI, N8N Nodes Apify +5
Slack & Telegram

piepdrive-test. Uses pipedriveTrigger, stickyNote, pipedrive, httpRequest. Event-driven trigger; 8 nodes.

Pipedrive Trigger, Pipedrive, HTTP Request +2
Slack & Telegram

piepdrive-test. Uses pipedriveTrigger, stickyNote, pipedrive, httpRequest. Event-driven trigger; 8 nodes.

Pipedrive Trigger, Pipedrive, HTTP Request +2
Slack & Telegram

Auto-create and publish AI social videos with Telegram, GPT-4 and Blotato. Uses httpRequest, stickyNote, telegramTrigger, telegram. Event-driven trigger; 42 nodes.

HTTP Request, Telegram Trigger, Telegram +2