{"id":13714357,"url":"https://github.com/bytebase/relay","last_synced_at":"2025-04-10T16:30:32.496Z","repository":{"id":59047113,"uuid":"530655699","full_name":"bytebase/relay","owner":"bytebase","description":"A web server for forwarding events from service A to service B","archived":false,"fork":false,"pushed_at":"2025-02-03T14:40:38.000Z","size":229,"stargazers_count":24,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T01:53:25.689Z","etag":null,"topics":["automation","feishu","github","go","iftt","lark","relay","webhook","zapier"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytebase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-30T12:52:02.000Z","updated_at":"2025-02-11T21:35:38.000Z","dependencies_parsed_at":"2024-04-05T14:52:59.961Z","dependency_job_id":null,"html_url":"https://github.com/bytebase/relay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Frelay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Frelay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Frelay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Frelay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytebase","download_url":"https://codeload.github.com/bytebase/relay/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252691,"owners_count":21072699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","feishu","github","go","iftt","lark","relay","webhook","zapier"],"created_at":"2024-08-02T23:01:57.854Z","updated_at":"2025-04-10T16:30:32.192Z","avatar_url":"https://github.com/bytebase.png","language":"Go","readme":"# Relay\n\n\u003cimg alt=\"Relay Logo\" src=\"assets/logo.png\" /\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/bytebase/relay\"\u003e\n    \u003cimg alt=\"go report\" src=\"https://goreportcard.com/badge/github.com/bytebase/relay\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nRelay is a web server for forwarding events from service A to service B. While forwarding the event, it allows injecting arbitrary logic for processing the event such as filtering and augmenting.\n\nYou may think Relay as a very very simplified version of self hosted [Zapier](https://zapier.com).\n\n# Overview\n\n\u003cimg alt=\"Overview\" src=\"assets/overview.png\" /\u003e\u003c/a\u003e\n\nRelay Contains 2 components, Hooker and Sinker.\n\nHooker - Receive the webhook event from upstream services such as GitHub, GitLab, do some processing, and pass the processed payload to Sinker.\n\nSinker - Receive the payload from Hooker, do some processing, and send the event to downstream services such as Slack, Lark.\n\nTo relay an event from Service A to Service B, you would\n1. Implement a Hooker to receive event from service A.\n1. Implement a Sinker to process payload from that Hooker and send the processed message to Service B.\n1. Register the Hooker to listen to event from service A and register the Sinker with the Hooker.\n\n# Common Flags\n\n#### `--address` (Env `RELAY_ADDR`)\n\nThe address where Relay runs. Default `localhost:5678`.\n\n# Supported Hookers\n\n## GitHub\n\n*When configuring GitHub Webhook, make sure to set the webhook content type as `application/json`.*\n\n### Flags\n\n#### `--github-ref-prefix`\n\nThe prefix for the GitHub ref. GitHub Webhook iteself doesn't allow to specify a particular branch or branch filter. You can use `--github-ref-prefix` to only observe the events from the interested branch(es).\n\n## Gerrit\n\n### Flags\n\nCurrently we only support monitor one branch in one repository.\n\n#### `--gerrit-repository`\n\nTarget repository. Will ignore the webhook message if the repository mismatched.\n\n#### `--gerrit-branch`\n\nTarget branch in the repository. Will ignore the webhook message if the branch mismatched.\n\n#### `--gerrit-url`\n\nThe Gerrit service URL. We need to call the Gerrit service to list files in the change, and get the file content in the change.\n\n#### `--gerrit-account`\n\nThe Gerrit account name.\n\n#### `--gerrit-password`\n\nThe Gerrit account password.\n\n# Supported Sinkers\n\n## Lark\n\n### Flags\n\n#### `--lark-urls`\n\nA comma-separated list of Lark message group webhook URLs.\n\n## Bytebase\n\nThe Bytebase sinker will receive messages from the Gerrit hook, then create the issue for the SQL change.\n\n#### `--bytebase-url`\n\nThe Bytebase service URL. You can use the external URL in production.\nCheck the docs about external URL: https://www.bytebase.com/docs/get-started/install/external-url\n\n#### `--bytebase-service-account`\n\nThe Bytebase service account. Used to call the Bytebase OpenAPI.\n\n#### `--bytebase-service-key`\n\nThe Bytebase service key. Used to call the Bytebase OpenAPI.\n\n# Quickstart\n\n```sh\n$ go run main.go --github-ref-prefix=\"refs/heads/release/\" --lark-urls=\"https://open.feishu.cn/open-apis/bot/v2/hook/foo\" --gerrit-account=\"\u003cgerrit-account\u003e\" --gerrit-password=\"\u003cgerrit-password\u003e\" --gerrit-repository=\"\u003cgerrit-repository\u003e\" --gerrit-branch=\"\u003cgerrit-branch\u003e\" --bytebase-url=\"https://bytebase.example.com\" --bytebase-service-account=\"\u003cbytebase-service-account\u003e\" --bytebase-service-key=\"\u003cbytebase-service-key\u003e\"\n\n# --lark-url can also be a comma separated list\n$ go run main.go --github-ref-prefix=\"refs/heads/release/\" --lark-urls=\"https://open.feishu.cn/open-apis/bot/v2/hook/foo,https://open.feishu.cn/open-apis/bot/v2/hook/bar\" --gerrit-account=\"\u003cgerrit-account\u003e\" --gerrit-password=\"\u003cgerrit-password\u003e\" --gerrit-repository=\"\u003cgerrit-repository\u003e\" --gerrit-branch=\"\u003cgerrit-branch\u003e\" --bytebase-url=\"https://bytebase.example.com\" --bytebase-service-account=\"\u003cbytebase-service-account\u003e\" --bytebase-service-key=\"\u003cbytebase-service-key\u003e\"\n\n# Runs on localhost:8080\n$ go run main.go --address=localhost:8080 --github-ref-prefix=\"refs/heads/release/\" --lark-urls=\"https://open.feishu.cn/open-apis/bot/v2/hook/foo\" --gerrit-account=\"\u003cgerrit-account\u003e\" --gerrit-password=\"\u003cgerrit-password\u003e\" --gerrit-repository=\"\u003cgerrit-repository\u003e\" --gerrit-branch=\"\u003cgerrit-branch\u003e\" --bytebase-url=\"https://bytebase.example.com\" --bytebase-service-account=\"\u003cbytebase-service-account\u003e\" --bytebase-service-key=\"\u003cbytebase-service-key\u003e\"\n```\n","funding_links":[],"categories":["Repositories"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebase%2Frelay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytebase%2Frelay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebase%2Frelay/lists"}