Skip to content

Reddit API Setup

Admin walkthrough for the Reddit integration. End-user flow: Connections → Reddit.

Overview

Form fieldOptions key
Client IDreddit_client-id
Client Secretreddit_client-secret
User Agentreddit_user-agent
Statusreddit_integration_status

ENV fallback: REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_USER_AGENT.

User Agent is mandatory

Reddit's API rejects requests with a missing or generic User-Agent header (429 Too Many Requests even on the first call). Set a meaningful UA in the form web:com.example.sosyabot:v3.43.6 (by /u/yourhandle).

Step-by-step on www.reddit.com/prefs/apps

1. Sign in and create an app

Sign in to Reddit with the account that should own the app, then go to https://www.reddit.com/prefs/apps.

Click are you a developer? create an app... at the bottom of the page.

2. Fill in the form

  • name: e.g. "Sosyabot"
  • type: web app (required for the OAuth code flow Sosyabot uses)
  • description: optional
  • about url: https://sosyabot.com
  • redirect uri:
    https://app.sosyabot.com/api/v1/auth/reddit/callback

Click create app.

3. Grab Client ID + Client Secret

After creation the app appears in your apps list with two values shown directly:

  • Client ID: the short string under the app name (looks like a 14-character random string).
  • Client Secret: labelled secret.

You can reveal the secret again later by clicking edit.

Pasting into Sosyabot admin panel

/admin/api-integration/reddit:

  1. Client ID: paste the short string.
  2. Client Secret: paste the secret.
  3. User Agent: something like web:com.sosyabot:v3.43.6 (by /u/your-reddit-handle). Required — Sosyabot defaults to Sosyabot/1.0 only as a last resort.
  4. Status: Enable.
  5. Save → Test credentials.

Failure: Reddit integration disabled: client id/secret not configured.

Verification

/app/channels → Connect → Reddit → OAuth → approve identity submit mysubreddits read flair. Pick a default subreddit on the post-connect screen. Submit a test self-post from /app/publishing (some subreddits gate API submissions to "approved submitters" — start with r/test).

Troubleshooting

SymptomCauseFix
Reddit integration disabled: client id/secret not configuredAdmin + ENV emptySteps 1–3.
429 Too Many Requests on first requestGeneric / missing User-AgentSet a meaningful User Agent per the warning above.
Submit fails with SUBREDDIT_NOTALLOWEDSubreddit doesn't accept API submissions from non-approved accountsPick a different subreddit or get the user account approved by mods.
invalid_grant after weeks of inactivityRefresh token may have been revoked from Reddit account settingsUser reconnects from /app/channels.

ENV fallback

REDDIT_CLIENT_ID=<your client id>
REDDIT_CLIENT_SECRET=<your client secret>
REDDIT_USER_AGENT=web:com.sosyabot:v3.43.6 (by /u/yourhandle)

After editing .env run ./service.sh restart api.