Reddit API Setup
Admin walkthrough for the Reddit integration. End-user flow: Connections → Reddit.
Overview
| Form field | Options key |
|---|---|
| Client ID | reddit_client-id |
| Client Secret | reddit_client-secret |
| User Agent | reddit_user-agent |
| Status | reddit_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:
- Client ID: paste the short string.
- Client Secret: paste the secret.
- User Agent: something like
web:com.sosyabot:v3.43.6 (by /u/your-reddit-handle). Required — Sosyabot defaults toSosyabot/1.0only as a last resort. - Status: Enable.
- 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
| Symptom | Cause | Fix |
|---|---|---|
Reddit integration disabled: client id/secret not configured | Admin + ENV empty | Steps 1–3. |
429 Too Many Requests on first request | Generic / missing User-Agent | Set a meaningful User Agent per the warning above. |
Submit fails with SUBREDDIT_NOTALLOWED | Subreddit doesn't accept API submissions from non-approved accounts | Pick a different subreddit or get the user account approved by mods. |
invalid_grant after weeks of inactivity | Refresh token may have been revoked from Reddit account settings | User 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.