# Reddit

> Submit posts and comments and read subreddit listings on Reddit.

App · Social Media · 3 actions. Web page: https://docs.lodol.com/docs/integrations/reddit

## Actions

### Comment on a post

Reply to a Reddit post or comment. Provide the parent's fullname (a post is t3_… and a comment is t1_…).

**Inputs**

- Parent fullname (`parent_id`, text, required): The fullname of the post or comment to reply to, for example, t3_1a2b3c.
- Comment (`text`, text, required): The comment body (Markdown supported).

**Outputs**

- `body` (text)
- `id` (text)
- `link_id` (text)
- `name` (text)
- `permalink` (text)

**Example output**

```json
{
  "body": "Thanks for sharing!",
  "id": "9z8y7x",
  "link_id": "t3_1a2b3c",
  "name": "t1_9z8y7x",
  "permalink": "/r/test/comments/1a2b3c/hello/9z8y7x/"
}
```

### Get subreddit posts

List posts from a subreddit by hot, new, top, or rising.

**Inputs**

- Subreddit (`subreddit`, text, required): The subreddit to read, for example, python.
- Sort (`sort`, text): Which listing to read. One of: `hot`, `new`, `top`, `rising`. Default: `hot`.
- Limit (`limit`, number): Maximum number of posts to return (1-100). From 1 to 100. Default: `10`.

**Outputs**

- `posts` (list)

**Example output**

```json
{
  "posts": [
    {
      "author": "someuser",
      "id": "1a2b3c",
      "name": "t3_1a2b3c",
      "num_comments": 12,
      "permalink": "/r/python/comments/1a2b3c/interesting_article/",
      "score": 128,
      "subreddit": "python",
      "title": "Interesting article",
      "url": "https://example.com/article"
    }
  ]
}
```

### Submit a post

Submit a text or link post to a subreddit from the connected account.

**Inputs**

- Subreddit (`subreddit`, text, required): The subreddit to post to, for example, test.
- Title (`title`, text, required): The post title.
- Post type (`post_type`, text): Whether to submit a self (text) post or a link post. One of: `self` (Text post), `link` (Link post). Default: `self`.
- Text (`text`, text): Body text for a text post (ignored for link posts).
- Link URL (`url`, text): The URL for a link post (required when Post type is Link).

**Outputs**

- `id` (text): The post's short ID.
- `name` (text): The post's fullname (t3_...).
- `subreddit` (text)
- `title` (text)
- `url` (text)

**Example output**

```json
{
  "id": "1a2b3c",
  "name": "t3_1a2b3c",
  "subreddit": "test",
  "title": "Hello from Lodol",
  "url": "https://www.reddit.com/r/test/comments/1a2b3c/hello/"
}
```
