Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simov/slack-incoming-quotes
Slack Incoming WebHook with Quotes
https://github.com/simov/slack-incoming-quotes
slack
Last synced: 16 days ago
JSON representation
Slack Incoming WebHook with Quotes
- Host: GitHub
- URL: https://github.com/simov/slack-incoming-quotes
- Owner: simov
- License: mit
- Created: 2017-06-03T12:45:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-04T13:16:14.000Z (over 6 years ago)
- Last Synced: 2024-11-06T19:54:39.255Z (2 months ago)
- Topics: slack
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slack-incoming-quotes
Slack Incoming WebHook with Quotes
# Install
```bash
npm install -g slack-incoming-quotes
```# CLI
```bash
slack-incoming-quotes \
--config /path/to/config.json \
--db /path/to/db.json \
--quotes /path/to/quotes.json \
--env environment
```# config.json
```json
{
"development": {
"slack": { "see below" }
}
}
```The `username`, `icon_url` and `channel` keys are optional and take effect only if the hook is a *Custom Integration*. These 3 keys have no effect for bundled *OAuth Apps*.
> Single hook:
```json
"slack": {
"hook": "[Hook URL]",
"username": "[App Name]",
"icon_url": "[App Avatar]",
"channel": "[Target #channel or @user]"
}
```> Multiple hooks with a common `username`, `icon_url` and `channel` configuration:
```json
"slack": {
"hook": [
"[Hook URL 1]",
"[Hook URL 2]"
],
"username": "[App Name]",
"icon_url": "[App Avatar]",
"channel": "[Target #channel or @user]"
}
```> Multiple hooks with separate `username`, `icon_url` and `channel` configuration:
```json
"slack": [
{
"hook": "[Hook URL 1]",
"username": "[App Name]",
"icon_url": "[App Avatar]",
"channel": "[Target #channel or @user]"
},
{
"hook": [
"[Hook URL 2]",
"[Hook URL 3]"
],
"username": "[App Name]",
"icon_url": "[App Avatar]",
"channel": "[Target #channel or @user]"
}
]
```# db.json
```js
{
"development": {
"index": 0
},
"production": {
"index": 0
}
}
```# quotes.json
```js
{
"quote 1",
"quote 2",
"...",
}
```# Crontab
```bash
# Run on every 15 min:
*/15 * * * * node slack-incoming-quotes [params] >> slack-incoming-quotes.log
```# API
```js
var hook = require('slack-incoming-quotes')hook({
config: require('config.json'),
db: require('db.json'),
dpath: '/absolute/path/to/db.json',
quotes: require('quotes.json'),
env: 'development'
})
.then((responses) => {
responses.forEach(([res, body]) => {
console.log(new Date().toString(), res.statusCode, body)
})
})
.catch((err) => console.error(new Date().toString(), err))
```