{
  "id": "5",
  "name": "Slack-GitHub User Info",
  "nodes": [
    {
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        300,
        300
      ],
      "webhookId": "dacd64a7-a83e-4492-b8fe-363453906d0d",
      "parameters": {
        "path": "dacd64a7-a83e-4492-b8fe-363453906d0d",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1,
      "id": "node-b9332f71"
    },
    {
      "name": "GraphQL",
      "type": "n8n-nodes-base.graphql",
      "position": [
        500,
        300
      ],
      "parameters": {
        "query": "=query {\nuser(login:\"{{$node[\"Webhook\"].json[\"body\"][\"text\"]}}\"){\nname\ncompany\nlocation\navatarUrl\nemail\npullRequests(last: 25) {\nedges {\nnode {\ncommits(last:25) {\nnodes {\ncommit {\nauthor {\nemail\nname\n}\n}\n}\n}\n}\n}\n}\n}\n}",
        "endpoint": "{{ $env.API_ENDPOINT }}",
        "requestFormat": "json",
        "responseFormat": "string",
        "headerParametersUi": {
          "parameter": [
            {
              "name": "User-Agent",
              "value": "n8n"
            },
            {
              "name": "Authorization",
              "value": "bearer <Personal Token>"
            }
          ]
        }
      },
      "typeVersion": 1,
      "id": "node-8a2ae4e6"
    },
    {
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        700,
        300
      ],
      "parameters": {
        "functionCode": "let emails = [];\nlet tempEmails = [];\nconst name = $node[\"GraphQL\"].json[\"data\"][\"data\"][\"user\"][\"name\"];\nconst publicEmail = $node[\"GraphQL\"].json[\"data\"][\"data\"][\"user\"][\"email\"];\nconst username = $node[\"Webhook\"].json[\"body\"][\"text\"];\nconst nameRegex = new RegExp(name,\"g\")\n\nif(publicEmail){\n// if public email address exists, push it to the tempEmails array\n  tempEmails.push(publicEmail)\n}\n\n// looping through the pull requests\nfor(const edge of items[0].json.data.data.user.pullRequests.edges){\n // looping through the commits\n  for(node of edge.node.commits.nodes){\n\n    // Checks the name associated with the email address\n    if(nameRegex.test(node.commit.author.name)|| node.commit.author.name == username) {\n     // if name equals to contributors name or username, push the email address in tempEmails\n      tempEmails.push(node.commit.author.email)\n    }\n  }\n}\n\n// Remove duplicates\nemails = [...new Set(tempEmails)]\n\n// RegEx Pattern for email address generated by GitHub\nlet re = /^\\w+(.)*@users.noreply.github.com/\n\n// Remove the email addresses Generated by GitHub\nemails = emails.filter(email => !re.test(email))\n\n\nreturn [{json:{emails,}}]\n"
      },
      "typeVersion": 1,
      "id": "node-1335de42"
    },
    {
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        900,
        300
      ],
      "parameters": {
        "channel": "={{$node[\"Webhook\"].json[\"body\"][\"channel_id\"]}}",
        "attachments": [
          {
            "title": "=GitHub Details for: {{$node[\"Webhook\"].json[\"body\"][\"text\"]}}"
          },
          {
            "text": "=*Name:*  {{$node[\"GraphQL\"].json[\"data\"][\"data\"][\"user\"][\"name\"]}}\n*Email:* {{$node[\"Function\"].json[\"emails\"].join(', ')}}\n*Company:* {{$node[\"GraphQL\"].json[\"data\"][\"data\"][\"user\"][\"company\"]}}\n*Location:* {{$node[\"GraphQL\"].json[\"data\"][\"data\"][\"user\"][\"location\"]}}"
          },
          {
            "thumb_url": "{{ $env.BASE_URL }}"
          }
        ],
        "otherOptions": {},
        "authentication": "{{ $credentials.oAuth2 }}"
      },
      "credentials": {
        "slackOAuth2Api": "Slack OAuth2"
      },
      "typeVersion": 1,
      "id": "node-85e7f462"
    },
    {
      "id": "error-4c74cd63",
      "name": "Error Handler",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1000,
        400
      ],
      "parameters": {
        "message": "Workflow execution error",
        "options": {}
      }
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3
  },
  "connections": {},
  "meta": {
    "instanceId": "workflow-734555f1",
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:52.328228",
    "updatedAt": "2025-09-29T07:07:52.328236",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "description": "Production-ready workflow: Slack-GitHub User Info. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}