This repository introduces a trigger that automatically sends hot posts from specified subreddits to a designated Slack channel.
- Sign up for a Reddit account. Ensure that your
username
andpassword
are registered. - Create a Reddit application. Important: Select "script" as the application type from the available options (web app, installed app, script).
- Note down the
client id
andclient secret
values. - Set up the following secrets in this repository:
REDDIT_CLIENT_ID
REDDIT_CLIENT_SECRET
REDDIT_USERNAME
REDDIT_PASSWORD
- Add the names of the subreddits to
.github/workflows/slack-reddit-posts.yaml
.
- Create a slack application.
- Install the application to your Slack workspace.
- In
OAuth & Permissions
, addchat:write
to theBot Token Scopes
. - Create a new channel and add the application to it.
- Set up the following secrets in this repository:
SLACK_API_TOKEN
SLACK_CHANNEL_ID
$ python main.py -h
usage: main.py [-h]
[--reddit-client-id REDDIT_CLIENT_ID]
[--reddit-client-secret REDDIT_CLIENT_SECRET]
[--reddit-username REDDIT_USERNAME]
[--reddit-password REDDIT_PASSWORD]
[--subreddit-name SUBREDDIT_NAME]
[--n-posts N_POSTS]
[--slack-api-token SLACK_API_TOKEN]
[--slack-channel-id SLACK_CHANNEL_ID]
options:
-h, --help show this help message and exit
--reddit-client-id REDDIT_CLIENT_ID Reddit Client ID
--reddit-client-secret REDDIT_CLIENT_SECRET Reddit Client Secret
--reddit-username REDDIT_USERNAME Reddit Username
--reddit-password REDDIT_PASSWORD Reddit Password
--subreddit-name SUBREDDIT_NAME Subreddit Name
--n-posts N_POSTS Max Posts Number
--slack-api-token SLACK_API_TOKEN Slack API Toekn
--slack-channel-id SLACK_CHANNEL_ID Slack Channel ID