Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/govtechsg/chatbot-notifier
This application allow sending of messages to chat group with token ecryption capabilities
https://github.com/govtechsg/chatbot-notifier
chatbots notification-service telegram
Last synced: 2 months ago
JSON representation
This application allow sending of messages to chat group with token ecryption capabilities
- Host: GitHub
- URL: https://github.com/govtechsg/chatbot-notifier
- Owner: GovTechSG
- License: mit
- Created: 2019-12-16T06:06:49.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-24T03:49:45.000Z (about 5 years ago)
- Last Synced: 2024-06-21T07:40:36.051Z (7 months ago)
- Topics: chatbots, notification-service, telegram
- Language: Go
- Size: 20.5 KB
- Stars: 5
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chatbot-notifier
chatbot-notifier is a tool for sending message with telegram bot while securing chat id and token using AWS KMS.
chatbot-notifier aims to make sending notification to telegram chat group in an easy yet secure way.## How it works
chatbot-notifier uses aws-sdk-go to implement the encryption and decryption operation. Thus you will require an amazon web services access key id and secret access key. Similar to using terraform or terragrunt, AWS_PROFILE have to be pass in the command line. Example will be "AWS_PROFILE= notifier send -f credential.yml -m textfile.txt". This profile read from ~/.aws/credentials. If the access key id and secret access key are set as default profile in ~/.aws/credentials, then AWS_PROFILE will not need to be pass. Example "notifier send -f credential.yml -m textfile.txt".
Example of ~/.aws/credential
```aws
[default]
role_arn = arn:aws:iam::123456789012:role/testing
source_profile = default
role_session_name = OPTIONAL_SESSION_NAME[profile_project1]
role_arn = arn:aws:iam::123456789012:role/testing
source_profile = default
role_session_name = OPTIONAL_SESSION_NAME
```For more information, see
notifier will then get key from AWS KMS to encrypt credential.yml. ENCRYPTED credential.yml WILL NOT BE ABLE TO DECRYPT THROUGH notifier. THIS IS TO ENSURE THAT TOKEN AND CHAT ID ARE SAFE IN THE SERVER.
notifier will then be able to send message using credential.yml.
## Usage Example
### Encrypt credential.yml
```bash
notifier encrypt -f credential.ymlor
AWS_PROFILE=profile_project1 notifier encrypt -f credential.yml
```### Message can only be send after encryption
Sending message file content to chat group
```bash
notifier send -f credential.yml -m message.txtor
AWS_PROFILE=profile_project1 notifier send -f credential.yml -m message.txt
```
Sending text message to chat group
```bash
notifier text -f credential.yml -m "Hello World"or
AWS_PROFILE=profile_project1 notifier text -f credential.yml -m "Hello World"
```
## credential.yml format (SAMPLE NOT REAL INFOR) (File can be other name)
For more information on how to get token, see
To get your chat id, update the URL with your bot token /getUpdates>```yaml
aws:
- arn: arn:aws:kms:ap-southeast-1:XXXXXXXXXX:key/XXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX
telegram:
- token: 2312312312:DASDASGSDFDSFADSA
chatid: -32213123123
```## message.txt (File can be other name)
Any free text file.
### Self-compile
```bash
git clone https://github.com/GovTechSG/chatbot-notifier.git# MacOS
env GOOS=darwin GOARCH=amd64 go build -o notifier cmd/notifier/main.go# Linux
env GOOS=linux GOARCH=amd64 go build -o notifier cmd/notifier/main.go# Window
env GOOS=windows GOARCH=amd64 go build -o notifier cmd/notifier/main.go
```