{"id":26331472,"url":"https://github.com/jerson/nats-webhook","last_synced_at":"2026-04-11T20:37:54.134Z","repository":{"id":149681162,"uuid":"253339840","full_name":"jerson/nats-webhook","owner":"jerson","description":"Simple Webhook server and store in NATS streaming for use later.","archived":false,"fork":false,"pushed_at":"2020-04-06T04:17:59.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T01:57:40.438Z","etag":null,"topics":["golang","nats","nats-streaming","publish","streaming","subscribe","webhook"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jerson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-05T21:56:24.000Z","updated_at":"2024-12-27T21:34:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"d85ca8f0-4454-4ce7-8a13-c355532bf30d","html_url":"https://github.com/jerson/nats-webhook","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jerson/nats-webhook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerson%2Fnats-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerson%2Fnats-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerson%2Fnats-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerson%2Fnats-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerson","download_url":"https://codeload.github.com/jerson/nats-webhook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerson%2Fnats-webhook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31695165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T20:18:30.949Z","status":"ssl_error","status_checked_at":"2026-04-11T20:18:29.982Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang","nats","nats-streaming","publish","streaming","subscribe","webhook"],"created_at":"2025-03-15T22:37:29.040Z","updated_at":"2026-04-11T20:37:54.126Z","avatar_url":"https://github.com/jerson.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NATS Webhook\n\nSimple Webhook server and store in `NATS streaming` for use later.\n\n## Usage\n\nJust use this endpoint for a Webhook\n\n```bash\nhttp://localhost:8080/event/{source}/{subject}\n```\n\n- `{source}`: just a name like \"mysource\" its for identify later on `NATS`\n- `{subject}`: subject event for Publish to `NATS`\n\nLater you can subscribe to any subject a usual its on `NATS streaming`\n\n```go\npackage main\nimport (\n\t\"fmt\"\n  \"time\"\n\t\"github.com/nats-io/stan.go\"\n)\n\nfunc main(){\n    sc, err := stan.Connect(\"default\", \"itsme\", stan.NatsURL(\"nats://localhost:4222\"))\n    if err != nil {\n      panic(err)\n    }\n    defer sc.Close()\n\n    sub, err := sc.Subscribe(\"mysubject\", func(m *stan.Msg) {\n      fmt.Printf(\"Hi: %s\\n\", string(m.Data))\n      m.Ack()\n    })\n    if err != nil {\n      panic(err)\n    }\n    defer sub.Unsubscribe()\n\n    // delay for wait some seconds... its not really required\n    time.Sleep(time.Second * 10)\n}\n```\n\n**IMPORTANT**: `m.Data` is json.Marshal of `Payload` struct\n\n```go\ntype Payload struct {\n\tID      string `json:\"id\"`\n\tSource  string `json:\"source\"`\n\tSubject string `json:\"subject\"`\n\tBody    []byte `json:\"body\"`\n}\n```\n\n## Deploy\n\n### Config\n\nBefore deploy you should know all vars, you have two options:\n\n#### config.toml\n\n```toml\n[server]\nport=8080\n\n[api]\nkey=\"sampletoken\"\n\n[nats]\nendpoint=\"nats://localhost:4222\"\nclient_id=\"webhook\"\ncluster_id=\"nats\"\n```\n\n#### Environments vars\n\n```bash\nexport APP_SERVER_PORT=8080\nexport APP_API_KEY=sampletoken\nexport APP_NATS_ENDPOINT=nats://localhost:4222\nexport APP_NATS_CLIENTID=webhook\nexport APP_NATS_CLUSTERID=nats\n```\n\n### Authorization\n\nif you define `APP_API_KEY` env or `key=\"sampletoken\"` in `config.toml` you should send `Authorization` header like this `Authorization: Bearer {sampletoken}`\n\n### Docker\n\nYou can use a `docker-compose.yml` like this\n\n```yaml\nversion: \"3\"\nservices:\n  webhook:\n    image: registry.gitlab.com/pardacho/nats-webhook:latest\n    environment:\n      - DEBUG=true\n      - APP_NATS_ENDPOINT=nats://nats:4222\n      - APP_NATS_CLUSTERID=default\n      - APP_API_KEY=sampletoken\n    ports:\n      - 8080:8080\n  nats:\n    image: nats-streaming:latest\n    volumes:\n      - storage:/data\n    command:\n      - \"--cluster_id\"\n      - \"default\"\n      - \"-store\"\n      - \"file\"\n      - \"-dir\"\n      - \"/data\"\n      - \"-p\"\n      - \"4222\"\n    ports:\n      - 4222:4222\nvolumes:\n  storage:\n```\n\n### Binaries\n\njust go to `Releases` section, download an run in your server\n\n\u003chttps://github.com/jerson/nats-webhook/releases\u003e\n\n### Script\n\n```bash\ncurl -sfL https://raw.githubusercontent.com/jerson/nats-webhook/master/install.sh | sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerson%2Fnats-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerson%2Fnats-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerson%2Fnats-webhook/lists"}