{"id":46005847,"url":"https://github.com/rbague/panic-notifier","last_synced_at":"2026-02-28T23:08:14.261Z","repository":{"id":57601752,"uuid":"164937991","full_name":"rbague/panic-notifier","owner":"rbague","description":"HTTP middleware that notifies panics on a webserver","archived":false,"fork":false,"pushed_at":"2019-10-06T19:12:06.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-07-30T20:15:09.727Z","etag":null,"topics":["go","golang","notification-service","panic","slack","webserver"],"latest_commit_sha":null,"homepage":null,"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/rbague.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":null,"security":null,"support":null}},"created_at":"2019-01-09T21:06:27.000Z","updated_at":"2019-10-06T19:12:07.000Z","dependencies_parsed_at":"2022-09-26T20:00:43.949Z","dependency_job_id":null,"html_url":"https://github.com/rbague/panic-notifier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rbague/panic-notifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbague%2Fpanic-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbague%2Fpanic-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbague%2Fpanic-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbague%2Fpanic-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbague","download_url":"https://codeload.github.com/rbague/panic-notifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbague%2Fpanic-notifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29954583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["go","golang","notification-service","panic","slack","webserver"],"created_at":"2026-02-28T23:08:13.664Z","updated_at":"2026-02-28T23:08:14.253Z","avatar_url":"https://github.com/rbague.png","language":"Go","readme":"# PANIC-NOTIFIER\n\n[![GoDoc](https://godoc.org/github.com/rbague/panic-notifier/integration?status.svg)](https://godoc.org/github.com/rbague/panic-notifier/integration)\n[![Go Report Card](https://goreportcard.com/badge/github.com/rbague/panic-notifier)](https://goreportcard.com/report/github.com/rbague/panic-notifier)\n\nPanic notifier is based in the [Exception Notification](https://github.com/smartinez87/exception_notification/) ruby gem. You should definitely give it a look.\n\n---\n\nThe purpose of this library is to receive a notification into an integration everytime a webserver panics.\nRight now, the built-in notifiers can deliver notifications to Slack, email and via custom WebHooks.\n\n## Getting Started\n\n```go\ngo get github.com/rbague/panic-notifier\n```\n\n### Usage\n\nTo start using it with [go-chi/chi](https://github.com/go-chi/chi), [gorilla/mux](https://github.com/gorilla/mux) or similar:\n\n```go\npackage main\n\nimport \"github.com/rbague/panic-notifier\"\n\nfunc main() {\n    r := chi.NewRouter() // github.com/go-chi/chi\n    r := mux.NewRouter() // github.com/gorilla/mux\n\n    s := integration.NewSlack(\"INCOMING_WEBHOOK_URL\")\n    r.Use(notifier.Middleware(s))\n\n    ...\n}\n```\n\n## Integrations\n\npanic-notifier relies on integrations to deliver the notifications to the different services, here are the default ones:\n\n-   [Slack](#slack)\n-   [Email](#email)\n-   [WebHooks](#webhooks)\n\nBut you could easily implement your [custom integration](#custom-integration).\n\n### Slack\n\nThis integration delivers the notification to a slack channel using the [slack-webhook](https://github.com/rbague/slack-webhook) library.\n\n#### Usage\n\nTo start using it you only need to provide the webhook url.\n\n```go\npackage main\n\nimport \"github.com/rbague/panic-notifier\"\n\nfunc main() {\n    r := chi.NewRouter() // github.com/go-chi/chi\n\n    slack := integration.NewSlack(\"INCOMING_WEBHOOK_URL\")\n    r.Use(notifier.Middleware(slack))\n\n    ...\n}\n```\n\nFor production uses, recommend calling the following method with a `*http.Client` so it does not use the default client to deliver the notification.\n\n```go\nslack.SetHTTPClient(*http.Client)\n```\n\n### Email\n\nThis integration delivers the notification via email using SMTP.\n\n#### Usage\n\nTo start using it with the default configuration you only need to provide a GMail email and password:\n\n```go\npackage main\n\nimport \"github.com/rbague/panic-notifier\"\n\nfunc main() {\n    r := chi.NewRouter() // github.com/go-chi/chi\n\n    email := integration.NewDefaultEmail(\"YOUR_EMAIL@gmail.com\", \"YOUR_PASSWORD\")\n    r.Use(notifier.Middleware(email))\n\n    ...\n}\n```\n\nThe default configuration uses gmail's SMTP server (smtp.gmail.com) with SSL enabled (port: 465).\nBut this canbe easily overridden by providing your on configuration:\n\n```go\npackage main\n\nimport \"github.com/rbague/panic-notifier\"\n\nfunc main() {\n    r := chi.NewRouter() // github.com/go-chi/chi\n\n    config := \u0026SMTPConfig{\n\t\tAddr:     \"smtp.example.org\",\n\t\tPort:     587,\n\t\tUser:     \"YOUR_EMAIL@gmail.com\",\n\t\tPassword: \"YOUR_PASSWORD\",\n\t}\n    email := integration.NewEmail(config)\n    r.Use(notifier.Middleware(email))\n\n    ...\n}\n```\n\n### WebHooks\n\nThis integration delivers the notification via the HTTP protocol.\nRight now each request is sent using the `POST` method.\n\n#### Usage\n\nTo start using it you only need to provide the webhook url.\n\n```go\npackage main\n\nimport \"github.com/rbague/panic-notifier\"\n\nfunc main() {\n    r := chi.NewRouter() // github.com/go-chi/chi\n\n    wh := integration.NewWebHook(\"WEBHOOK_URL\")\n    r.Use(notifier.Middleware(wh))\n\n    ...\n}\n```\n\nThe WebHook type exposes its `Client` field, so the http.Client can be changed for production uses.\n\n### Custom integration\n\nCreating a custom integration is as easy as implementing the integration.Integration interface.\n\n```go\n// Integration is the interface used to deliver a notification of a panic\ntype Integration interface {\n\t// StackTraceLines return the number of stack trace lines\n\t// to be sent in each notification\n\tStackTraceLines() int\n\n\t// Deliver delivers the given notification and returns an error if any.\n\tDeliver(*Notification) error\n}\n```\n\n## TODO\n\nAdd integrations for:\n\n-   [x] Slack\n-   [x] Email\n-   [x] WebHooks\n\nOther:\n\n-   [ ] Add option to send custom data\n-   [ ] Add tests\n-   [ ] Allow custom webhooks to use other methods than POST\n\n## License\n\nCopyright (c) 2018 Roger Bagué Martí, released under the [MIT license](http://www.opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbague%2Fpanic-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbague%2Fpanic-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbague%2Fpanic-notifier/lists"}