Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simov/slack-incoming-twitter
Slack Incoming WebHook for Twitter
https://github.com/simov/slack-incoming-twitter
slack
Last synced: 16 days ago
JSON representation
Slack Incoming WebHook for Twitter
- Host: GitHub
- URL: https://github.com/simov/slack-incoming-twitter
- Owner: simov
- License: mit
- Created: 2017-06-03T11:05:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-29T20:55:07.000Z (over 7 years ago)
- Last Synced: 2024-11-06T19:54:39.060Z (2 months ago)
- Topics: slack
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slack-incoming-twitter
Slack Incoming WebHook for Twitter
# Install
```bash
npm install -g slack-incoming-twitter
```# CLI
```bash
slack-incoming-twitter \
--config /path/to/config.json \
--db /path/to/db.json \
--env environment
```# config.json
```json
{
"development": {
"twitter": {
"id": "[Organization Screen Name]",
"app": {
"key": "[OAuth Consumer Key]",
"secret": "[OAuth Consumer Secret]"
},
"user": {
"token": "[OAuth Access Token]",
"secret": "[OAuth Access Secret]"
}
},
"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": {
"id": "0"
},
"production": {
"id": "0"
}
}
```# Crontab
```bash
# Run on every 15 min:
*/15 * * * * node slack-incoming-twitter [params] >> slack-incoming-twitter.log
```# API
```js
var hook = require('slack-incoming-twitter')hook({
config: require('config.json'),
db: require('db.json'),
dpath: '/absolute/path/to/db.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))
```