send2teams
Small CLI tool used to submit messages to Microsoft Teams.
![Validate Docs](https://github.com/atc0005/send2teams/workflows/Validate%20Docs/badge.svg)
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
- Ubuntu Linux 16.04+
How to install it
- Download Go
- Install Go
- Clone the repo
cd /tmp
git clone https://github.com/atc0005/send2teams
cd send2teams
- Install dependencies (optional)
- for Ubuntu Linux
sudo apt-get install make gcc
- for CentOS Linux
sudo yum install make gcc
- Build
- for current operating system with default
go
build options
- for all supported platforms
- for Windows
- for Linux
- Copy the applicable binary to whatever systems that need to run it
- Linux:
/tmp/send2teams/send2teams
- 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