{"id":15324215,"url":"https://github.com/baderkha/notify-go","last_synced_at":"2026-05-08T18:32:07.688Z","repository":{"id":58468063,"uuid":"531163697","full_name":"baderkha/notify-go","owner":"baderkha","description":"A Lightweight cli / sdk to orchestrate sending messages to different channels  (Slack , Discord , Telegram)","archived":false,"fork":false,"pushed_at":"2022-09-06T03:45:33.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T14:52:36.921Z","etag":null,"topics":["cli","discord","discord-bot","golang","slack","slack-bot","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baderkha.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-31T16:18:12.000Z","updated_at":"2022-08-31T22:40:35.000Z","dependencies_parsed_at":"2022-09-03T17:21:22.179Z","dependency_job_id":null,"html_url":"https://github.com/baderkha/notify-go","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/baderkha/notify-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baderkha%2Fnotify-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baderkha%2Fnotify-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baderkha%2Fnotify-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baderkha%2Fnotify-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baderkha","download_url":"https://codeload.github.com/baderkha/notify-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baderkha%2Fnotify-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32792032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"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":["cli","discord","discord-bot","golang","slack","slack-bot","telegram","telegram-bot"],"created_at":"2024-10-01T09:25:14.324Z","updated_at":"2026-05-08T18:32:07.665Z","avatar_url":"https://github.com/baderkha.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Notify-Go\n\n \u003cp align=\"center\"\u003e\u003cimg src=\"./assets/logo/logo_new_1.png?raw=true\" width=\"256px\" align=\"center\"/\u003e \u003c/p\u003e\n\n\nNotify Go is a **free** command line / API that allows you to easily send (bot style) messages to a recipient . This features a base implementation for all your favourite messaging platforms \n\nlike :\n-  telegram \n-  discord \n-  slack \n\n\n\n**Note**: \n*this is not a 2 way messaging protocol . This project only publishes messages*\n\nAlso , I would like to mention ,  Slack and Discord both use `webhooks` . So if you just want to use those and have simple needs . **NO NEED TO USE THIS SOLUTION** it's overkill. Just Send an http request to the webhook route with the body. ie curl it. \n\n\n\n\nIt's aimed to be super minimal and simple to configure.\nThis solution is great for the following scenarios :\n- Command Line Notifications\n- System Notifications\n- IOT Devices\n- Home Automation\n- Anything that can run linux .\n\n----\n\n\u003ch2 align=\"center\"\u003e Contents \u003c/h2\u003e\n\nTable of contents\n- [Usage](#Notify-go)\n- [Installation](#-installation-)\n    - [API](#a-api-mode-installation)\n    - [Command Line](#b-command-line-installation)\n- [Authorization Setup](#-authorization-setup-) -- you cannot skip this step\n- [API Usage](#-api-usage-)\n- [Cli Usage](#-cli-usage-)\n\n\n---\n\n\u003ch2 align=\"center\"\u003e Installation \u003c/h2\u003e\n\n## A) API Mode Installation\n\nTo use the API in your existing go code simply run the following\n```bash \ngo get -u github.com/baderkha/notify-go\n```\n\n## B) Command Line Installation\n\n1) go to [release page](https://github.com/baderkha/notify-go/releases)\n\n2) download the binary that matches your system\n  \n\n3)  [windows instrructions]\n   - if on windows , then just download the .msi file\n   - install it on your computer\n\n3) [unix instructions] move to path\n\n    Linux \n\n    move binary to /usr/local/bin\n    ```bash\n    sudo mv ~/Downloads/notify-go-linux-x86 /usr/local/bin/notify-go\n    sudo chmod +x /usr/local/bin/notify-go\n    ```\n\n    Mac\n\n    move binary to /usr/local/bin\n    ```bash\n    sudo mv ~/Downloads/notify-go-linux-x86 /usr/local/bin/notify-go\n    sudo chmod +x /usr/local/bin/notify-go\n    ```\n    \n\n\n---\n\n\u003ch2 id=\"authorization-setup\" align=\"center\"\u003e Authorization Setup \u003c/h2\u003e\n\n\u003cp style=\"color:red\"\u003e *Note you must do this in order to use the cli/api*\u003c/p\u003e\n\n\nThis section will cover how to setup authorization for each of the message senders . Note that \n\n- [Slack](https://api.slack.com/messaging/webhooks)\n    - you need to create an app\n    - give it permissions \n    - create a webhook \n    - use that webhook with this cli / api\n- [Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks)\n    - go to your server settings\n    - under integrations (create a webhook)\n    - call it a cool name\n    - use that webhook with this cli / api\n- [Telegram]()\n    - // todo\n\n\n\n\n---\n\n \u003ch2 align=\"center\"\u003e API Usage \u003c/h2\u003e \n This section will cover how to use the api.\n\n *Note You Need Go **v1.18+*** Since The API uses generics\n\n## MessageSender\n`notify.MessageSender` is an interface which has implementations for slack,discord,and telegram. If your usage is simple and you only want to message Discord for example . Then attaching this interface is perfect for you.\n\n\n\n\n\n### Slack Instructions  \n\n1) init\n``` go\nslackSender := notify.NewSlackSender()\n```\n\n2) send a message to a webhook\n\n``` go\nerr := slackSender.Send(\"https://slack.channel.com/your/other/channel/webhook\",[]byte(\"some_message\"))\nif err != nil {\n    log.Fatal(err)\n}\n\n```\n\n\n\n### Discord Instructions\nDiscord is very similar to slack since it also uses webhooks to send messages to a chat . So the init logic is the same .\n\n1) init\n``` go\ndiscSender := notify.NewDiscordSender()\n```\n\n2) send a message to a different webhook\n\n``` go\nerr := discSender.Send(\"https://slack.channel.com/your/other/channel/webhook\",[]byte(\"somemessage\"))\nif err != nil {\n    log.Fatal(err)\n}\n\n```\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Manager\n\n`notify.Manager` enables you to orchestrate sending messages to multiple social platforms . This should be used only if you expect your application to use more than 1 notification platform . \n\n[Otherwise see](#MessageSender)\n\n1) init\n\n``` go\n// default contains all the clients\nmsgMgr := notify.Default()\n```\n\n2) send a message to a specific client (discord , slack , telegram)\n\n``` go\n// send to a specific client like discord\nerr := msgMgr.SendToSpecificType(\n    notify.DiscordSenderType,\n    \"https://www.some-webhook.url.com\",\n    []byte(\"hi mom\"),\n)\n```\n\n3) broadcast same message to all clients\n\n``` go\n// 1 - create a mapping\nralias := notify.NewEmptyRecieverAlias()\n// returns an error \n_ = ralias.Add(notfy.DiscordSenderType,\"https://www.google.com\")\n_ = ralias.Add(notify.SlackSenderType,\"https://www.google.com\")\n\n// 2 - send msg\nmsgMgr.SendAll(ralias,[]byte(\"hi mom \"))\n\n```\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Implement your own sender\n\nTo implement your own Message publisher client you have to implement the `notify.Sender` Method and then add your sender to the manager\n\n\n``` go\nSend(reciever string, bodyContent []byte) error\n```\n\nExample : \n\n1) Implement the interface\n```go \n// equivalent of implements keyword\nvar _ notify.Sender = \u0026WhatsappSender{}\n\ntype WhatsappSender struct {}\n\nfunc (w *WhatsappSender) Send(reciver string , bodyContent[]byte) error {\n    return nil\n}\n```\n\n2) [Optional] Enroll it to the manager if you're using it in tandum with other services\n``` go\n// your main go\nfunc main() {\n    mgr := notify.Default()\n    mgr.AddSender(\"whatsapp\",new(WhatsappSender))\n\n    _ = msgMgr.SendToSpecificType(\n        \"whatsapp\",\n        \"chat_id\",\n        []byte(\"hi mom\"),\n    )\n\n}\n```\n\n----\n\n\u003ch2 align=\"center\"\u003e Cli Usage \u003c/h2\u003e\n\n### Help\n\n```bash\nnotify-go --help\n```\n\n\u003cbr\u003e\n\n### Managing Contacts\n\nContacts allow you to map channels / entities to different social profiles . IE you can map your 1 channel to discord , slack , telegram\n\nThis is **powerful** , because you can leverage the broadcast functionality of the cli to send to all those channel with 1 alias\n\nExample : \n\n- Add Contact Entry\n    ```bash\n    notify-go newcon crypto_channel\n    ```\n\n- Add Contact Social Mapping\n\n    this will make it easy for you to reference by name\n    rather than have to repaste the webhook everytime\n\n    ```bash\n    notify-go apcon crypto_channel discord https://www.google.com\n    notify-go apcon crypto_channel slack https://www.google.com\n    ```\n\n- List Contacts\n\n    Allows you to list all / 1 contact\n\n    - all\n        ```bash\n        notify-go cons \n        ```\n    - specific\n        ```bash\n        notify-go cons crypto_channel\n        ```\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n### Sending Messages\n\n- with webhook\n    ```bash\n    notify-go msg discord https://webhook.com \"hi mom\"\n    ```\n- through contact alias (see above section for how to create contacts)\n    ```bash\n    notify-go msg discord crypto_channel \"hi mom\"\n    ```\n- to all social platforms via contact mapping*\n    in this scenario we setup mapping for crypto_channel to discord\n    and slack . So this will send to **both** channels concurrently\n    ```bash\n    notify-go msgcon crypto_channel \"hi mom\"\n    ```\n\n\n### Broadcasting messages\n\n***Note** this will message everyone in the contact list and all platforms. use this with caution :)*\n\n```bash\nnotify-go msgbrod \"hi mom\"\n```\n\n\n\n---\n\n[^1]: By Ahmad Baderkhan\n\n[^2]: License *Apache-V2*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaderkha%2Fnotify-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaderkha%2Fnotify-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaderkha%2Fnotify-go/lists"}