ChatGPTSalesFinding leadsAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Auto-Answer GitHub PR Tech Questions: GPT-4o + Notion + Slack n8n Workflow

GitHub PR comment trigger → detect question → GPT-4o generates answer → Notion archive → Slack notify

Some experienceStepsWorkflowPrompt
Who
Development teams and engineering leads using GitHub for code review
You get
When PR comments contain "how do I..." / "how to..." questions, automatically trigger AI to generate 2-3 line technical answers, store in Notion, and push to Slack
You need
n8n · GitHub · Notion · Google Sheets · Slack

Constraints

Prerequisites: accessible n8n instance; GitHub OAuth credentials with webhook access; Azure OpenAI GPT-4o access; Notion integration (database ID); Slack API; Google Sheets API (error logging). Workflow triggers via GitHub webhook requiring a publicly accessible webhook URL. Template hardcodes specific repository (weather-app) and Slack user that must be replaced. Notion node parameters show all fields mapped to identical property key, requiring manual correction to actual database property names.

What they did

Author rahul08 published this workflow template (id=10331) in the n8n template library. The template demonstrates a complete automation: listening for GitHub PR review comment events, validating webhook data, detecting question keywords, calling Azure OpenAI GPT-4o to generate brief technical answers, using a JavaScript Code node to extract structured metadata, storing in a Notion database, and pushing results to Slack. An error branch logs exceptions to Google Sheets.

How it went

The author claims this workflow reduces repetitive manual answering, promotes engineering knowledge sharing, and keeps teams informed with AI-generated technical insights (author_report, no quantitative data). The template has 118 views on n8n.io.

Worth knowing

1. The template hardcodes a specific GitHub repository (saurabhg97/weather-app) and Slack user (U09HMPVD466), which must be changed after import. 2. The Notion node's propertiesUi maps all fields to the same 'Name|title' property key, causing data overwrites; actual use requires remapping to the database's real property names. 3. The system message limits answers to 2-3 lines, which may be insufficient for complex technical questions and require human expansion. 4. Keyword detection only covers "how do i" and "how to"; other question forms (e.g., "what is", "why does") will not trigger the workflow. 5. This site has not actually run or tested this workflow (reproduction=not_tested).

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • Configure GPT-4o Model node: connect azureOpenAiApi credentials.
  • GitHub PR Comment Trigger node: connect githubOAuth2Api credentials.
  • Save Comment Insight to Notion Database node: connect Notion API credentials.
  • Log Errors in Google Sheets node: connect Google Sheets OAuth2 credentials.
  • Post AI Answer & PR Link to Slack node: connect Slack API credentials.

Configuration to replace

  • Source template is n8n public workflow #10331 (~18 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Configure GitHub PR Comment Trigger

    Add a GitHub Trigger node in n8n, select event type pull_request_review_comment. Specify repository owner and name (template defaults to saurabhg97/weather-app, must be replaced). Configure OAuth2 authentication, ensuring the n8n instance can receive GitHub webhooks via a public URL. When triggered, captures comment body, file path, PR number, and author info.

  2. Validate Webhook Data Integrity

    Add an IF node to check if incoming webhook data contains a valid comment URL. Condition: $json.body.comment.url is not empty. If validation passes, proceed to question detection branch; if failed, route error data to Google Sheets error log.

    Execution prompt · Source text。IF node conditions.leftValue: validate comment URL exists

    ={{ $json.body.comment.url }}
  3. Detect Developer Question Pattern

    Add a second IF node, scanning comment body for "how do i" or "how to" keywords (case-insensitive). If matched, proceed to AI answer generation; if no match, workflow ends silently.

    Execution prompt · Source text。IF node conditions.leftValue: detect question keywords

    ={{ 
      (
        $json["body"]["comment"]["body"].toLowerCase().includes("how do i") ||
        $json["body"]["comment"]["body"].toLowerCase().includes("how to")
      ).toString()
    }}
  4. Configure GPT-4o Model Connection

    Add an Azure OpenAI Chat Model node, select model gpt-4o. Configure Azure OpenAI API credentials (endpoint, API key, deployment name). This node serves as the language model for the subsequent AI Agent to call, and does not directly process input.

  5. Generate AI Technical Answer

    Add an AI Agent node, connecting to the GPT-4o model from previous step. The node uses define prompt mode, injecting PR comment content and context into the prompt. System message sets answer style: short, clear, technically correct, maximum 2-3 lines.

    Execution prompt · Source text。AI Agent node parameters.text: dynamically inject comment content and PR context

    ={{ 
    `Question: ${$json["body"]["comment"]["body"]}
    
    Context: PR Link - ${$json["body"]["comment"]["html_url"]}
    Repository: ${$json["body"]["repository"]["full_name"]}
    ` 
    }}

    Execution prompt · Source text。AI Agent node parameters.options.systemMessage: system instruction controlling answer length and style

    =You are a helpful developer assistant. 
    Provide short, clear, and technically correct answers (2–3 lines max) to developer questions found in GitHub PR comments.
  6. Extract Comment Metadata

    Add a Code node (JavaScript), extracting repository name, comment content, author username, file path, and PR number from the original webhook data, outputting as standard JSON format for the Notion node.

    Execution prompt · Source text。Code node parameters.jsCode: extract and structure GitHub comment metadata

    // Access the original webhook data
    const webhookData = $(' GitHub PR Comment Trigger').first().json;
    
    return [
      {
        json: {
          repository: webhookData.body.repository.full_name,
          comment: webhookData.body.comment.body,
          username: webhookData.body.comment.user.login,
          file_path: webhookData.body.comment.path,
          pr_number: webhookData.body.pull_request.number
        }
      }
    ];
  7. Save to Notion Database

    Add a Notion node, select resource type databasePage. Specify database ID (template uses 'test db', must be replaced with actual database). Map fields from previous JSON step to Notion properties. **Note**: The template maps all fields to the same 'Name|title' key, which is likely a template error; actual use requires remapping to real database property names (e.g., Repository, Comment, Author, File Path, PR Number).

  8. Push Answer to Slack

    Add a Slack node, select target user or channel (template hardcodes user U09HMPVD466, must be replaced). Message content combines AI-generated answer with original PR comment link for team members to quickly view context.

    Execution prompt · Source text。Slack node parameters.text: combine AI output with PR comment URL

    ={{ $('Generate AI Response for Developer Question').item.json.output }}{{ $('Detect Developer Question in PR Comment').item.json.body.comment.url }}

Prompt you can copy

Setup guidance · Editorial suggestion。Give to setup assistant: confirm inputs and permissions first, then guide step-by-step configuration

This block is the prompt. Ads are never placed here.

You are a setup assistant helping users replicate the "GitHub PR Auto-Answer" workflow in n8n. First confirm the user has ready: n8n instance (publicly accessible), GitHub OAuth credentials, Azure OpenAI GPT-4o access, Notion database, Slack workspace permissions, Google Sheets (for error logging). Then guide configuration step by step, with special attention to replacing hardcoded values in the template (repository name, Slack user, Notion database ID and property names).

All hardcoded test values must be replaced; Notion property mapping requires manual correction

Source

Auto-answer GitHub PR questions with GPT-4o, Notion & Slack for dev teams · rahul08 · n8n.io · 2025-10-30

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related