Reddit

Description: Enable agents to interact with Reddit.

Author: Arcade

Code: GitHub

Auth: User authorization via the Reddit auth provider

PyPI VersionLicensePython VersionsWheel StatusDownloads

The Arcade Reddit toolkit provides a pre-built set of tools for interacting with Reddit. These tools make it easy to build agents and AI apps that can:

  • Submit text posts
  • Comment on posts
  • Reply to comments
  • Get posts (title and other metadata) in a subreddit
  • Get content (body) of posts
  • Get top-level comments of a post

Install

pip install arcade_reddit

pip installing the toolkit is not needed if you’re using the tools hosted on Arcade Cloud.

Available Tools

These tools are currently available in the Arcade Reddit toolkit.

Tool NameDescription
SubmitTextPostSubmit a text-based post to Reddit.
CommentOnPostComment on a Reddit post.
ReplyToCommentReply to a Reddit comment.
GetPostsInSubredditGets posts titles, links, and other metadata in the specified subreddit
GetContentOfPostGet content (body) of a Reddit post.
GetContentOfMultiplePostsGet content (body) of multiple Reddit posts.
GetTopLevelCommentsOfPostGet the first page of top-level comments of a Reddit post.

If you need to perform an action that’s not listed here, you can get in touch with us to request a new tool, or create your own tools with the Reddit auth provider.

SubmitTextPost


Submit a text-based post to a subreddit

Parameters

  • subreddit (string, required) The name of the subreddit to which the post will be submitted.
  • title (string, required) The title of the submission.
  • body (string, optional) The body of the post in markdown format. Should never be the same as the title.
  • nsfw (boolean, optional) Indicates if the submission is NSFW. Default is False.
  • spoiler (boolean, optional) Indicates if the post is marked as a spoiler. Default is False.
  • send_replies (boolean, optional) If true, sends replies to the user’s inbox. Default is True.

CommentOnPost


Comment on a Reddit post.

Parameters

  • post_identifier (string, required) The identifier of the Reddit post. The identifier may be a Reddit URL, a permalink, a fullname, or a post id.
  • text (string, required) The body of the comment in markdown format.

ReplyToComment


Reply to a Reddit comment

Parameters

  • comment_identifier (string, required) The identifier of the Reddit comment to reply to. The identifier may be a comment ID, a Reddit URL to the comment, a permalink to the comment, or the fullname of the comment.
  • text (string, required) The body of the reply in markdown format.

GetPostsInSubreddit


Gets posts titles, links, and other metadata in the specified subreddit.

The time_range is required if the listing type is ‘top’ or ‘controversial’.

Parameters

  • subreddit (string, required) The name of the subreddit to fetch posts from.
  • listing (enum (SubredditListingType), optional) The type of listing to fetch. For simple listings such as ‘hot’, ‘new’, or ‘rising’, the time_range parameter is ignored. For time-based listings such as ‘top’ or ‘controversial’, the ‘time_range’ parameter is required. Default is ‘hot’.
  • limit (integer, optional) The maximum number of posts to fetch. Default is 10, max is 100.
  • cursor (str, optional) The pagination token from a previous call.
  • time_range (enum (RedditTimeFilter), optional) The time range for filtering posts. Must be provided if the listing type is ‘top’ or ‘controversial’. Otherwise, it is ignored. Defaults to ‘today’.

GetContentOfPost


Get the content (body) of a Reddit post by its identifier.

Parameters

  • post_identifier (string, required) The identifier of the Reddit post. The identifier may be a Reddit URL, a permalink, a fullname, or a post id.

GetContentOfMultiplePosts


Get the content (body) of multiple Reddit posts by their identifiers in a single request

Parameters

  • post_identifiers (list of strings, required) A list of identifiers of the Reddit posts. The identifiers may be Reddit URLs, permalinks, fullnames, or post ids.

GetTopLevelCommentsOfPost


Get the first page of top-level comments of a Reddit post.

Parameters

  • post_identifier (string, required) The identifier of the Reddit post. The identifier may be a Reddit URL, a permalink, a fullname, or a post id.

Auth

The Arcade Reddit toolkit uses the Reddit auth provider to connect to users’ Reddit accounts.

With the hosted Arcade Engine, there’s nothing to configure. Your users will see Arcade as the name of the application that’s requesting permission.

With a self-hosted installation of Arcade, you need to configure the Reddit auth provider with your own Reddit app credentials.

Reference

SubredditListingType

The type of listing to fetch.

  • HOT (string: “hot”): The hottest posts in the subreddit.
  • NEW (string: “new”): The newest posts in the subreddit.
  • RISING (string: “rising”): The posts that are trending up in the subreddit.
  • TOP (string: “top”): The top posts in the subreddit (time-based).
  • CONTROVERSIAL (string: “controversial”): The posts that are currently controversial in the subreddit (time-based).

RedditTimeFilter

The time range for filtering posts.

  • NOW (string: “NOW”)
  • TODAY (string: “TODAY”)
  • THIS_WEEK (string: “THIS_WEEK”)
  • THIS_MONTH (string: “THIS_MONTH”)
  • THIS_YEAR (string: “THIS_YEAR”)
  • ALL_TIME (string: “ALL_TIME”)