AutomationFlowsSlack & Telegram › Automated Workflow Backups to Github with Pr Creation & Slack Notifications

Automated Workflow Backups to Github with Pr Creation & Slack Notifications

ByBao Duy Nguyen @duynb on n8n.io

This template is ideal for DevOps engineers, automation specialists, and n8n users who manage multiple workflows and want a reliable version control system for backups. It’s especially useful for teams collaborating via GitHub.

Event trigger★★★★☆ complexity23 nodesn8nHTTP RequestGitHubSlack
Slack & Telegram Trigger: Event Nodes: 23 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #4463 — we link there as the canonical source.

This workflow follows the GitHub → HTTP Request 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
{
  "id": "GZqZRs30KLvYLk4T",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Backup workflows to GitHub",
  "tags": [],
  "nodes": [
    {
      "id": "3abc6972-965d-4333-b1d2-d7097ea077da",
      "name": "n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        660,
        -300
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9c386d7c-dc48-4f92-bc2f-5c5772e931f8",
      "name": "Find new workflows",
      "type": "n8n-nodes-base.merge",
      "position": [
        880,
        -250
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "keepNonMatches",
        "outputDataFrom": "input1",
        "fieldsToMatchString": "id"
      },
      "typeVersion": 3.1,
      "alwaysOutputData": true
    },
    {
      "id": "a82b074d-b12f-49f9-a69b-492847bb3dfd",
      "name": "Find updated workflows",
      "type": "n8n-nodes-base.merge",
      "position": [
        880,
        0
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "keepNonMatches",
        "outputDataFrom": "input1",
        "fieldsToMatchString": "id, updatedAt"
      },
      "typeVersion": 3.1,
      "alwaysOutputData": true
    },
    {
      "id": "8d6181f4-873b-46ad-aa88-a6005f78e618",
      "name": "Wait for GitHub create/edit file finished",
      "type": "n8n-nodes-base.merge",
      "position": [
        2680,
        -140
      ],
      "parameters": {},
      "typeVersion": 3.1
    },
    {
      "id": "aefdbaf3-bbb9-426b-bc01-1dfd1f094a87",
      "name": "Create new PR via GitHub API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2900,
        -140
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $('Define Local Variables').item.json.github_owner }}/{{ $('Define Local Variables').item.json.repo_name }}/pulls",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n\"title\": \"Automated PR for {{ $('Define Local Variables').item.json.branch_name }}\",\n\"body\": \"\",\n\"head\": \"{{ $('Define Local Variables').item.json.branch_name }}\",\n\"base\": \"main\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "bdcd0ef4-ebcd-43fc-b320-ee62bb3b9c71",
      "name": "Define Local Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        40,
        -160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "575b2ca9-528f-421f-8352-073c916fcd63",
              "name": "branch_name",
              "type": "string",
              "value": "=workflows_{{ $now.format('yyyy-MM-dd-hh-mm-ss')}}"
            },
            {
              "id": "6f7a1168-1c55-4e50-b7d2-0868104ee1db",
              "name": "github_owner",
              "type": "string",
              "value": "duynb92"
            },
            {
              "id": "9c8cf8ba-9e64-4fb5-ba38-8429264c84dd",
              "name": "repo_name",
              "type": "string",
              "value": "n8n-workflows"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b74a8a0c-5205-47fd-a9c9-60d8299a4254",
      "name": "Get all workflows on GitHub",
      "type": "n8n-nodes-base.github",
      "position": [
        220,
        50
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.github_owner }}"
        },
        "filePath": "workflows",
        "resource": "file",
        "operation": "list",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.repo_name }}"
        }
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "fd86d8e4-948e-4679-a995-87fcad2ceaaf",
      "name": "Get content for each workflow",
      "type": "n8n-nodes-base.github",
      "position": [
        440,
        50
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.github_owner }}"
        },
        "filePath": "={{ $json.path }}",
        "resource": "file",
        "operation": "get",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.repo_name }}"
        },
        "asBinaryProperty": false,
        "additionalParameters": {}
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "60b86288-22cd-460e-9da2-67de123b1cb1",
      "name": "Base64decode workflow content",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        50
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ $json.content.base64Decode() }}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "fc4d4f78-e6b3-418f-8c4f-8ad70eb5a32b",
      "name": "Wait for finished",
      "type": "n8n-nodes-base.merge",
      "position": [
        1100,
        -125
      ],
      "parameters": {
        "mode": "chooseBranch",
        "output": "empty"
      },
      "typeVersion": 3.1
    },
    {
      "id": "08db5cda-4059-4e96-9732-63bc824daa5d",
      "name": "If there are any changes in workflows",
      "type": "n8n-nodes-base.if",
      "position": [
        1320,
        -125
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "cec5563a-01dd-4372-882a-2114c8e476a7",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Find updated workflows').all() }}",
              "rightValue": ""
            },
            {
              "id": "fb800963-acc7-495f-8bf2-c29c3b3d0450",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Find new workflows').all() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "45369a54-bc73-4287-9037-1286d8a9690d",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1560,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d8b8a670-3ea1-4d5f-86e9-537f72d964fc",
      "name": "Create new branch via GitHub API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1760,
        -125
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $('Define Local Variables').item.json.github_owner }}/{{ $('Define Local Variables').item.json.repo_name }}/git/refs",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"ref\": \"refs/heads/{{ $('Define Local Variables').item.json.branch_name }}\",\n  \"sha\": \"{{ $json.object.sha }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "4292f0e4-3012-4165-bcda-e4a1519ca80c",
      "name": "Get latest commit SHA on main  via GitHub API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1540,
        -125
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $('Define Local Variables').item.json.github_owner }}/{{ $('Define Local Variables').item.json.repo_name }}/git/ref/heads/main",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "d0d727d9-f547-440b-8213-9ec5ce23c1fa",
      "name": "Wait until branch created",
      "type": "n8n-nodes-base.merge",
      "position": [
        1980,
        0
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.1,
      "alwaysOutputData": false
    },
    {
      "id": "89f36b7c-6de1-4069-83bd-8b6aeed4a069",
      "name": "Wait until branch created1",
      "type": "n8n-nodes-base.merge",
      "position": [
        1980,
        -250
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.1,
      "alwaysOutputData": false
    },
    {
      "id": "f8088f5b-cb9a-40eb-ab8f-de6aeddfdaa6",
      "name": "Filter empty data",
      "type": "n8n-nodes-base.filter",
      "notes": "Empty data can happen because 'Find new workflows' always output data",
      "position": [
        2200,
        -250
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "835f2dab-de42-4c97-a747-47b23d55c990",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 2.2
    },
    {
      "id": "157955f3-88bf-448d-b424-c71ba32d4fb5",
      "name": "Filter empty data1",
      "type": "n8n-nodes-base.filter",
      "notes": "Empty data can happen because 'Find updated workflows' always output data",
      "position": [
        2200,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1d8312fd-5157-4058-823c-35f7574541fa",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 2.2
    },
    {
      "id": "0c3e9957-d4e8-4b30-b368-7698087b37e7",
      "name": "Create new commit to add new workflow",
      "type": "n8n-nodes-base.github",
      "position": [
        2420,
        -250
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.github_owner }}"
        },
        "filePath": "=workflows/{{ $json.id }}.json",
        "resource": "file",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.repo_name }}"
        },
        "fileContent": "={{ $json.toJsonString() }}",
        "commitMessage": "=Add new workflow {{ $json.id }}",
        "additionalParameters": {
          "branch": {
            "branch": "={{ $('Define Local Variables').item.json.branch_name }}"
          }
        }
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "fd5091b9-7c6e-4408-8656-4dac64f10088",
      "name": "Create new commit to update changed workflow",
      "type": "n8n-nodes-base.github",
      "position": [
        2420,
        0
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.github_owner }}"
        },
        "filePath": "=workflows/{{ $json.id }}.json",
        "resource": "file",
        "operation": "edit",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Define Local Variables').item.json.repo_name }}"
        },
        "fileContent": "={{ $json.toJsonString() }}",
        "commitMessage": "=Update workflow {{ $json.id }}",
        "additionalParameters": {
          "branch": {
            "branch": "={{ $('Define Local Variables').item.json.branch_name }}"
          }
        }
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "63a97673-c96e-43ca-b3b2-cf264b2b1381",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        3120,
        -140
      ],
      "parameters": {
        "text": "=:firework: {{ $workflow.name }} executed succesfully. \nIt created a new <{{ $json.html_url }}|GitHub PR>.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08NZ6D9CRF",
          "cachedResultName": "n8n-notifications"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1ea514d9-bf41-4de4-938a-68bde8be660b",
      "name": "Click me to trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -200,
        -160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "aa9c2d16-d87b-42a6-b8af-6785fe212eee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -500
      ],
      "parameters": {
        "width": 280,
        "height": 260,
        "content": "## Setup\n1. GitHub credentials: Add your GitHub API credentials in n8n.\n2. Slack integration: Connect your Slack Bot token if you want PR notifications.\n3. Repository details: Update github_owner, repo_name, and workflow directory path in the \u201cDefine Local Variables\u201d node.\n4. n8n API key - [Check this doc](https://docs.n8n.io/api/authentication/)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c2e49f18-b2a4-4ced-a1a7-67dc69926a78",
  "connections": {
    "n8n": {
      "main": [
        [
          {
            "node": "Find new workflows",
            "type": "main",
            "index": 0
          },
          {
            "node": "Find updated workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter empty data": {
      "main": [
        [
          {
            "node": "Create new commit to add new workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for finished": {
      "main": [
        [
          {
            "node": "If there are any changes in workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter empty data1": {
      "main": [
        [
          {
            "node": "Create new commit to update changed workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find new workflows": {
      "main": [
        [
          {
            "node": "Wait until branch created1",
            "type": "main",
            "index": 1
          },
          {
            "node": "Wait for finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Click me to trigger": {
      "main": [
        [
          {
            "node": "Define Local Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Local Variables": {
      "main": [
        [
          {
            "node": "n8n",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get all workflows on GitHub",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find updated workflows": {
      "main": [
        [
          {
            "node": "Wait for finished",
            "type": "main",
            "index": 1
          },
          {
            "node": "Wait until branch created",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Wait until branch created": {
      "main": [
        [
          {
            "node": "Filter empty data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until branch created1": {
      "main": [
        [
          {
            "node": "Filter empty data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all workflows on GitHub": {
      "main": [
        [
          {
            "node": "Get content for each workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new PR via GitHub API": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Base64decode workflow content": {
      "main": [
        [
          {
            "node": "Find updated workflows",
            "type": "main",
            "index": 1
          },
          {
            "node": "Find new workflows",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get content for each workflow": {
      "main": [
        [
          {
            "node": "Base64decode workflow content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new branch via GitHub API": {
      "main": [
        [
          {
            "node": "Wait until branch created1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait until branch created",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new commit to add new workflow": {
      "main": [
        [
          {
            "node": "Wait for GitHub create/edit file finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If there are any changes in workflows": {
      "main": [
        [
          {
            "node": "Get latest commit SHA on main  via GitHub API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for GitHub create/edit file finished": {
      "main": [
        [
          {
            "node": "Create new PR via GitHub API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new commit to update changed workflow": {
      "main": [
        [
          {
            "node": "Wait for GitHub create/edit file finished",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get latest commit SHA on main  via GitHub API": {
      "main": [
        [
          {
            "node": "Create new branch via GitHub API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

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

This template is ideal for DevOps engineers, automation specialists, and n8n users who manage multiple workflows and want a reliable version control system for backups. It’s especially useful for teams collaborating via GitHub.

Source: https://n8n.io/workflows/4463/ — 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

Back Up Your N8N Workflows To Github. Uses manualTrigger, stickyNote, executeWorkflowTrigger, n8n. Event-driven trigger; 26 nodes.

Execute Workflow Trigger, n8n, HTTP Request +2
Slack & Telegram

This workflow will backup your workflows to Github. It uses the public api to export all of the workflow data using the n8n node.

Execute Workflow Trigger, n8n, HTTP Request +2
Slack & Telegram

This n8n template from Intuz provides a complete and automated solution for preparing and delivering context-rich briefings directly to attendees before every meeting.

Google Calendar Trigger, Notion, GitHub +3
Slack & Telegram

This workflow is ideal for n8n self-hosted users, DevOps engineers, and automation developers who want to automatically back up their n8n workflows to GitHub on a regular basis.

GitHub, n8n, HTTP Request +1
Slack & Telegram

Webhook Slack. Uses theHiveProjectTrigger, stickyNote, httpRequest, theHiveProject. Event-driven trigger; 63 nodes.

The Hive Project Trigger, HTTP Request, The Hive Project +1