-
Notifications
You must be signed in to change notification settings - Fork 6
Home
![](https://github.com/jcostello93/node-red-contrib-node-reddit/raw/master/screenshots/nodes.png)
Welcome to the node-red-contrib-node-reddit wiki!
Authentication for the Reddit API
To create a Reddit app and obtain its Client ID and Client Secret, log in to your Reddit account and visit this link.
There are 3 ways to provide authentication:
- Username/password: For long-term access. Possible for script-type apps only.
- Refresh token: For long-term access. Visit here to generate a token.
- Access token: For short-term access. Expires in one hour. Visit here to generate a token
Stream submissions and comments from a subreddit or PMs from your inbox.
- stream selection
- choose comments, submissions, or PMs.
- subreddit string
- the subreddit to stream (unused for PMs).
- filter selection
- choose which type of messages to stream from Inbox
- mark as read checkbox
- polltime number
- the refresh rate in seconds.
- timeout number
- the length of time to stream in seconds.
- payload
- details of the comment, submission, or PM.
- payload
- the standard error of the command.
Exclude the "r/" when entering your subreddit
. "r/subreddit
" will be
used for the display name if name
is left empty.
"u/credentials.username
" will be used for the display name if name
is left empty.
The polltime
is the number of seconds (between 2 and 3600) that the stream polls for updates.
Reddit enforces a ratelimit of 30 polls per minute. If your stream continues to hit the ratelimit, consider
increasing the polltime
.
The timeout
will stop the stream after the desired number of seconds.
If left blank, the stream will continue until the node is deleted from the flow, an error is thrown,
or node-RED is shutdown.
Get submissions, comments, or personal messages from a subreddit, user, your inbox or the listing’s id, according to its configuration.
- type
- the type of content to be retrieved
- source
- the source of the content
- subreddit
- the subreddit from which submissions or comments will be retrieved
- user
- the user who submitted the submissions or comments
- content_id
- the id of the listing to be retrieved
- sort
- the sorting method for the Reddit content
- time
- the time range for the Reddit content
- fetch_all
- the option to retrieve all possible content
- limit
- the number of listings to be retrieved
- depth
- an upper bound for replies in the comment tree
- payload
- details of the comment, submission, or PM.
- payload
- the standard error of the command.
Exclude the "r/" when entering a subreddit
and the "u/" when entering a user
All text input properties may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target subreddit
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the subreddit
field.
When a subreddit is the source, the newest comments from the subreddit are retrieved.
When a submission is the source, a comment tree is retrieved, broken up by the parent comments. Replies to these comments, if any, will be in msg.payload.replies
.
The fetch_all
property is only accessible when retrieving comments or submissions from a user, your own PMs, or comments from a submission.
If set to false
, the limit option will determine the number of listings to be retrieved. The Reddit API docs outline the rate limits.
Create a new Reddit submission or PM.
- type
- choose self-, link-, or cross-post, or PM.
- subreddit
- the subreddit to submit to.
- title
- the title of the submission.
- text
- the text of a self-post.
- url
- the url of a link-post.
- original
- the original listing name for a cross-post.
- recipient
- the recipient of the PM.
- subject
- the subject of the PM.
- message
- the mesage of a PM.
- payload
- the name of the new listing
- payload
- the standard error of the command.
Exclude the "r/" when entering your subreddit
. "r/subreddit
" will be
used for the display name if name
is left empty.
Exclude the "u/" when entering your recipient
. "u/recipient
" will be
used for the display name if name
is left empty.
All text input properties may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target subreddit
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the subreddit
field.
Reply to Reddit submissions, comments, or PMs
- type
- the type of content to be replied to
- content_id
- the id of the Reddit content to be replied to
- text
- the body of the response
- payload
- details of the comment, submission, or PM.
- payload
- the standard error of the command.
content_id
and text
may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target content_id
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the content_id
field.
Perform a Reddit search query in a subreddit.
- subreddit
- the subreddit to be searched
- query
- the search query
- time
- the time range of the search results
- sort
- the sort filter for the results
- payload
- details of the submission.
- payload
- the standard error of the command.
- payload
- details of the comment, submission, or PM.
- payload
- the standard error of the command.
Exclude the "r/" when entering a subreddit
and the "u/" when entering a user
content_id
and text
may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target query
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the query
field.
Edit a Reddit submission or comment.
- content_id
- the Reddit id of the content to be edited.
- type
- the type of the content to be edited.
- textstring
- the edited content.
- payload
- details of the edited comment or submission.
- payload
- the standard error of the command.
You can only edit your own Reddit content.
All text input properties may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target content_id
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the content_id
field.
Delete a Reddit submission, comment, or PM.
- content_id
- the Reddit id of the content to be deleted.
- type
- the type of the content to be deleted.
- none
You can only delete your own Reddit content.
All text input properties may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target content_id
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the content_id
field.
- payload
- the standard error of the command.
Save/unsave and/or vote/unvote on Reddit content.
- content_id
- the Reddit id of the content.
- type
- the type of the content.
- none
- payload
- the standard error of the command.
All text input properties may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, if the target content_id
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the content_id
field.
For all nodes other than config and stream, all text fields may be hardcoded via text or dynamically populated via mustache syntax relative to the incoming msg object.
For example, let's say you're getting hot submissions from a subreddit using the get node. If the target subreddit
is located in msg.payload.target
, then you can fill in {{payload.target}}
in the subreddit
field.