All Projects → catatsuy → Notify_slack

catatsuy / Notify_slack

Licence: mit
post to Slack on the command line

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Notify slack

Bolt Starter
A Bolt ⚡️ app template with useful settings for easier development
Stars: ✭ 37 (-36.21%)
Mutual labels:  slack
Mantisbt Slack
Slack integration for Mantis bug tracker
Stars: ✭ 45 (-22.41%)
Mutual labels:  slack
Octoslack
OctoPrint plugin for Slack, Mattermost, Pushbullet, Pushover, Rocket.Chat, Discord, Riot/Matrix, & Microsoft Teams
Stars: ✭ 50 (-13.79%)
Mutual labels:  slack
Slack Tui
TUI-based client for Slack
Stars: ✭ 38 (-34.48%)
Mutual labels:  slack
Webpack Deploy
Collection of useful utilities for deploying (not only) Webpack apps
Stars: ✭ 44 (-24.14%)
Mutual labels:  slack
Node Chat One To One
Node.js socket-io based one to one chat engine
Stars: ✭ 47 (-18.97%)
Mutual labels:  slack
Koffeemate
Fresh coffee announcements on Slack. Brewing accidents and statistics too. For Android, written 100% in Kotlin.
Stars: ✭ 35 (-39.66%)
Mutual labels:  slack
Slackbot
Slackbot for Keybase
Stars: ✭ 54 (-6.9%)
Mutual labels:  slack
Terminal Slack
Terminal client for slack
Stars: ✭ 1,030 (+1675.86%)
Mutual labels:  slack
Slack Poster
Simple gem to post messages on Slack using web hooks.
Stars: ✭ 49 (-15.52%)
Mutual labels:  slack
Old Slack Emojis
Bring back old emojis to new Slack!
Stars: ✭ 39 (-32.76%)
Mutual labels:  slack
Slack Memo Vim
Simple memo manager with Vim using Slack.
Stars: ✭ 40 (-31.03%)
Mutual labels:  slack
Craft Brief
Quick, easy, and customizable user-group notifications for Craft CMS.
Stars: ✭ 47 (-18.97%)
Mutual labels:  slack
Securitybot
Distributed alerting for the masses!
Stars: ✭ 987 (+1601.72%)
Mutual labels:  slack
Marvin
The paranoid bot (framework)
Stars: ✭ 51 (-12.07%)
Mutual labels:  slack
Slack Thel
The Genious L, now in slack to answer all your Queries! 😎
Stars: ✭ 36 (-37.93%)
Mutual labels:  slack
Synology Notifications
Synology notifications service
Stars: ✭ 47 (-18.97%)
Mutual labels:  slack
Receptionkit
A simple, customizable receptionist iPad app built with Smooch
Stars: ✭ 55 (-5.17%)
Mutual labels:  slack
Phlack
Slack Integrations for PHP
Stars: ✭ 53 (-8.62%)
Mutual labels:  slack
Slack Twitter
Read your timeline, fave tweets, and post to Twitter from Slack.
Stars: ✭ 47 (-18.97%)
Mutual labels:  slack

notify_slack

Notify slack from the command line. It receives standard input and notifies Slack all at once every second (can be changed with the -interval option).

Please watch this video. https://www.youtube.com/watch?v=wmKSr9Aoz-Y

Installation

I recommend you to use the binaries on GitHub Releases. Please download the latest version and use it.

If you have a development environment for the Go language, you can compile and install it by yourself.

GO111MODULE=on go get github.com/catatsuy/notify_slack/cmd/notify_slack

If you want to develop it, you can use the make. It requires Go 1.15 or higher.

make

If you use make, the output of notify_slack -version is git commit ID.

usage

./bin/notify_slack posts to Slack. You specify the setting in command line option or toml setting file. If both settings are specified, command line option will always take precedence.

./bin/output | ./bin/notify_slack

./bin/output is used for testing. While buffering, to post to slack.

./bin/notify_slack README.md

You post the file as a snippet. token and channel is required to use the Slack Web API.

If you want to upload to snippet via standard input, you must specify -snippet. If you specify filename, you can change the file name on Slack.

git diff | ./bin/notify_slack -snippet -filename git.diff

Slack's API can specify filetype. You can also specify -filetype. But it is automatically determined from the extension of the file. You make sure to give the appropriate extension.

file type | Slack

CLI options

-c string
      config file name
-channel string
      specify channel (unavailable for new Incoming Webhooks)
-filename string
      specify a file name (for uploading to snippet)
-filetype string
      specify a filetype (for uploading to snippet)
-icon-emoji string
      specify icon emoji (unavailable for new Incoming Webhooks)
-interval duration
      interval (default 1s)
-slack-url string
      slack url (Incoming Webhooks URL)
-snippet
      switch to snippet uploading mode
-token string
      token (for uploading to snippet)
-username string
      specify username (unavailable for new Incoming Webhooks)
-version
      Print version information and quit

toml configuration file

By default check the following files.

  1. a file specified with -c
  2. $HOME/.notify_slack.toml
  3. $HOME/etc/notify_slack.toml
  4. /etc/notify_slack.toml

The contents of the toml file are as follows.

[slack]
url = "https://hooks.slack.com/services/**"
token = "xoxp-xxxxx"
channel = "#general"
username = "tester"
icon_emoji = "🚀"
interval = "1s"

Note:

Tips:

  • If you want to default to another channel only for snippet, you can use snippet_channel.

How to create a token

You need to create a token if you use snippet uploading mode.

Create New App

At first, you need to create new app. Please access https://api.slack.com/apps.

  1. click Create New App
  2. input application name to App Name
  3. select your workspace on Development Slack Workspace
  4. click Create App

Basic Information

  1. click Permissions on Add features and functionality
  2. select files:write:user on Scopes and click Save Changes. You are able to choose Bot Token Scopes or User Token Scopes

OAuth & Permissions

  1. click Install App to Workspace
  2. install your app
  3. copy OAuth Access Token beginning with xoxp- or Bot User OAuth Access Token beginning with xoxb-

Add apps

  1. click Details on the channel which you want to post
  2. click Add apps on More
  3. choose your app

(Advanced) Environment Variables

Some settings can be given by the following environment variables.

NOTIFY_SLACK_WEBHOOK_URL
NOTIFY_SLACK_TOKEN
NOTIFY_SLACK_CHANNEL
NOTIFY_SLACK_SNIPPET_CHANNEL
NOTIFY_SLACK_USERNAME
NOTIFY_SLACK_ICON_EMOJI
NOTIFY_SLACK_INTERVAL

It will be useful if you want to use it on a container. If you use it, you don't need a configuration file anymore.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].