Skip to content

A trigger that automatically sends posts from subreddits to a Slack channel.

License

Notifications You must be signed in to change notification settings

dongminlee94/slack-reddit-posts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack Reddit Posts

This repository introduces a trigger that automatically sends hot posts from specified subreddits to a designated Slack channel.

Preparation

Reddit

  1. Sign up for a Reddit account. Ensure that your username and password are registered.
  2. Create a Reddit application. Important: Select "script" as the application type from the available options (web app, installed app, script).
  3. Note down the client id and client secret values.
  4. Set up the following secrets in this repository:
    • REDDIT_CLIENT_ID
    • REDDIT_CLIENT_SECRET
    • REDDIT_USERNAME
    • REDDIT_PASSWORD
  5. Add the names of the subreddits to .github/workflows/slack-reddit-posts.yaml.

Slack

  1. Create a slack application.
  2. Install the application to your Slack workspace.
  3. In OAuth & Permissions, add chat:write to the Bot Token Scopes.
  4. Create a new channel and add the application to it.
  5. Set up the following secrets in this repository:
    • SLACK_API_TOKEN
    • SLACK_CHANNEL_ID

Usage

$ 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

References

About

A trigger that automatically sends posts from subreddits to a Slack channel.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages