This connector provides a post and comment listener, as well as fairly common operations, against the Reddit API. The Post and Comment listeners automatically handle paginating through new submissions and filtering out already processed items.
This package is currently published via GitHub Packages. You can find the latest package here.
To utilize GitHub Packages with Maven you need to do the following:
- Log into GitHub
- Click on your profile image in the upper right and click on settings
- On the left navigation list, click on Developer settings
- On the left navigation list, click on Personal access tokens
- Click Generate new token
- Name tokens something like
GitHub Packages - Read
- Select the scope
read:packages
- no other scope is necessary. - Copy this token and save somewhere secure, such as LastPass. If you lose track of the token, you'll need to generate a new token.
- Add a new
server
entry
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings>
<servers>
<server>
<id>github-mule4-reddit-connector</id>
<username>GITHUB_USERNAME</username>
<password>GITHUB_PERSONAL_ACCESS_TOKEN</password>
</server>
</servers>
...
</settings>
- Create a new repository entry either in
pom.xml
orsettings.xml
if being used in multiple projects
<repository>
<id>github-mule4-reddit-connector</id>
<name>GitHub Mulesoft-FHIR Apache Maven Packages</name>
<url>https://maven.pkg.github.com/mikeacjones/mule4-reddit-connector</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
To connect to reddit, you need a reddit account and client_id
and client_secret
. These instructions assume you're using reddit.com and not old.reddit.com.
- Log into reddit.com
- Go to
User settings
- click on
Safety and Privacy
- Scroll to the bottom of the page and click on
Manage third-party app authorization
- Click button to create an app
- Select
persoanl use script
and generate. Copy and saveid
(visible code under app name) andsecret
. - Input these settings into global Reddit config object
By default, the comment and post listeners will only feed in new comments and posts since startup of app. If you would like to add the ability for the app to poll missed submissions, create a persistent object store and assign to listener.
Up to 100 new posts/comments are fed into the flow at a time, based on how many are found on each poll. The listener will continue firing even while flow is processing, so set your max concurrency if necessary.
The listeners will respect Reddit's rate limiting and attemp to automatically queue operations/polling; however, I don't recommend setting polling frequency lower than 5,000ms.
The following operations are support:
- Approve Thing
- Delete My Comment/Post
- Get Comment by Fullname
- Get Comments Listin g
- Get Host Posts Listing
- Get New Posts Listing
- Get Post Comments
- Get Post by Fullname
- Get Rising Posts Listing
- Get Subreddit Flair Templates
- Get Subreddit Moderators
- Get User Information
- Get User's Subreddit Flair
- Post Comment
- Remove Thing
- Send Private Message
- Set Comment/Post Lock Status
- Set Post Sticky
- Set User's Subreddit Flair (Extended)
- Set User's Subreddit Flair (Simple)
- Submit Text Post
- Update Comment/Text Post
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.