send2teams

command module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 7 Imported by: 0

README

send2teams

Small CLI tool used to submit messages to Microsoft Teams.

Latest Release GoDoc Validate Codebase Validate Docs

Project home

See our GitHub repo for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.

Overview

Small CLI tool used to submit messages to Microsoft Teams. send2teams is intended for use by Nagios, scripts or other actions that may need to submit pass/fail results to a MS Teams channel.

Many thanks to the developer/contributors of the dasrick/go-teams-notify package for making this tool possible.

Features

  • single binary, no outside dependencies
  • minimal configuration
  • very few build dependencies
  • optional conversion of messages with Windows, Mac or Linux newlines to <br> to increase compatibility with Teams formatting

Worth noting: This project uses Go modules (vs classic GOPATH setup)

Changelog

See the CHANGELOG.md file for the changes associated with each release of this application. Changes that have been merged to master, but not yet an official release may also be noted in the file under the Unreleased section. A helpful link to the Git commit history since the last official release is also provided for further review.

Requirements

  • Go 1.12+ (for building)
  • GCC
    • if building with custom options (as the provided Makefile does)
  • make
    • if using the provided Makefile

Tested using:

  • Go 1.13+
  • Windows 10 Version 1903
    • native
    • WSL
  • Ubuntu Linux 16.04+

How to install it

  1. Download Go
  2. Install Go
  3. Clone the repo
    1. cd /tmp
    2. git clone https://github.com/atc0005/send2teams
    3. cd send2teams
  4. Install dependencies (optional)
    • for Ubuntu Linux
      • sudo apt-get install make gcc
    • for CentOS Linux
      1. sudo yum install make gcc
  5. Build
    • for current operating system with default go build options
      • go build
    • for all supported platforms
      • make all
    • for Windows
      • make windows
    • for Linux
      • make linux
  6. Copy the applicable binary to whatever systems that need to run it
    1. Linux: /tmp/send2teams/send2teams
    2. Windows: /tmp/send2teams/send2teams.exe

Configuration Options

Command-line

Currently send2teams only supports command-line configuration flags. Requests for other configuration sources will be considered.

Flag Required Default Possible Description
h, help No N/A N/A Display Help; show available flags.
channel Yes valid Microsoft Teams channel name The target channel where we will send a message.
color No #832561 valid hex color code with leading # The hex color code used to set the desired trim color on submitted messages.
message Yes valid message string The (optionally) Markdown-formatted message to submit.
team Yes valid Microsoft Teams team name The name of the Team containing our target channel.
title Yes valid title string The title for the message to submit.
url Yes valid Microsoft Office 365 Webhook URL The Webhook URL provided by a pre-configured Connector.
verbose No false true, false Whether detailed output should be shown after message submission success or failure
silent No false true, false Whether ANY output should be shown after message submission success or failure
convert-eol No false true, false Whether messages with Windows, Mac and Linux newlines are updated to use break statements before message submission

Examples

One-off

This example illustrates the basics of using the application to submit a single message. This can serve as a starting point for use with Nagios, scripts or any other tool that calls out to others in order to perform its tasks.

./send2teams.exe -silent -channel "Testing" -message "Testing from command-line!" -title "Another test" -color "#832561" -url "https://outlook.office.com/webhook/www@xxx/IncomingWebhook/yyy/zzz"

Remove the -silent flag in order to see pass or failure output, otherwise look at the exit code ($?) or Microsoft Teams to determine results.

Accidentally typing the wrong flag results in a message like this one:

flag provided but not defined: -fake-flag

License

From the LICENSE file:

MIT License

Copyright (c) 2019 Adam Chalkley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

References

Documentation

Overview

send2teams is a small CLI tool used to submit messages to Microsoft Teams.

PROJECT HOME

See our GitHub repo (https://github.com/atc0005/send2teams) for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.

PURPOSE

send2teams is intended for use by Nagios, scripts or other actions that may need to submit pass/fail results to a MS Teams channel.

FEATURES

• single binary, no outside dependencies

• minimal configuration

• very few build dependencies

• optional conversion of messages with Windows, Mac or Linux newlines to `<br>` to increase compatibility with Teams formatting

USAGE

Help output is below. See the README for examples.

Usage of T:\github\send2teams\send2teams.exe:
-channel string
		The target channel where we will send a message
-color string
		The hex color code used to set the desired trim color on submitted messages (default "#832561")
-convert-eol
		Whether messages with Windows, Mac and Linux newlines are updated to use break statements before message submission
-message string
		The (optionally) Markdown-formatted message to submit
-silent
		Whether ANY output should be shown after message submission success or failure
-team string
		The name of the Team containing our target channel
-title string
		The title for the message to submit
-url string
		The Webhook URL provided by a preconfigured Connector
-verbose
		Whether detailed output should be shown after message submission success or failure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL