Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shoddyguard/slacknotificationscripts
Contains useful scripts for triggering Slack notifications from a variety of shells.
https://github.com/shoddyguard/slacknotificationscripts
powershell python slack
Last synced: about 1 month ago
JSON representation
Contains useful scripts for triggering Slack notifications from a variety of shells.
- Host: GitHub
- URL: https://github.com/shoddyguard/slacknotificationscripts
- Owner: shoddyguard
- License: bsd-2-clause
- Created: 2020-06-20T00:12:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-20T09:30:24.000Z (over 4 years ago)
- Last Synced: 2024-12-16T07:46:52.961Z (about 1 month ago)
- Topics: powershell, python, slack
- Language: PowerShell
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SlackNotificationScripts
This collection of scripts was born out of the need to find a simple and effective way of scripting notifications to Slack for various shell based tasks/workflows.* [Python](#python)
* [Python 3 Script](#notifyslackpy-python3-script)
* [PowerShell](#powershell)
* [PowerShell Script](#notifyslackps1-windows-powershell-script)
* [PowerShell cmdlet](#notifyslackpsm1-windows-powershell-module)## Python
### NotifySlack.py (Python3 Script)#### Usage
`NotifySlack.py `|Parameter |Required |Description |
|----------------|-----------------|---------------|
|--message (-m) |True |The message you would like to send |
|--webhook (-w) |True |The full webhook address assigned to the channel you'd like to send the message to |
|--colour (-c) |False |The hex code of the colour you'd like to appear around the message |
|--push (-p) |False |The message you'd like display in any pop-up/push/toast notifications|#### Example
```
NotifySlack.py --message 'Hello, world!' --webhook 'https://hooks.slack.com/my-webhook' --colour #FF0000 --push 'Foo Bar'
```
This would result in the 'Hello, world!' message being posted to the channel linked to the webhook, the message would have a red stripe alongside it and a pop-up notification entitled 'Foo Bar'## PowerShell
### NotifySlack.ps1 (Windows PowerShell Script)
#### Usage
`NotifySlack.ps1 `
|Parameter |Required |Description |
|----------------|-----------------|---------------|
|-Message |True |The message you would like to send |
|-Webhook |True |The full webhook address assigned to the channel you'd like to send the message to |
|-Colour |False |The hex code of the colour you'd like to appear around the message |
|-Push |False |The message you'd like display in any pop-up/push/toast notifications|#### Example
```
PS C:\> NotifySlack.ps1 -Message 'Foo Bar' -Webhook 'https://hooks.slack.com/my-webhook' -Colour '#FF0000' -Push 'Fizz Buzz'
```
This would send the 'Foo Bar' message to the channel linked to the given webhook.
The message would also have a red stripe down the side of it and the pop-up notification would say 'Fizz Buzz'### NotifySlack.psm1 (Windows PowerShell Module)
In certain situations it may make more sense to use a cmdlet rather than a commandline script therefore you can use the `NotifySlack.psm1` module.
The parameters are exactly the same as the `NotifySlack.ps1` script.#### Example
```
PS C:\> Import-Module NotifySlack.psm1
PS C:\> Invoke-SlackNotification -Message 'Hello, world!' -Webhook 'https://hooks.slack.com/my-webhook'
```
The first command imports the `NotifySlack` module and then the second sends the `Hello, world!` message to the channel linked with the given Webhook