This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // PEO Consulting Bot — Reddit API poster | |
| // Posts educational PEO content to small business subreddits | |
| // Uses Reddit OAuth2 password flow for script-type apps | |
| const postToReddit = async (title, text, subreddit) => { | |
| const tokenRes = await fetch('https://www.reddit.com/api/v1/access_token', { | |
| method: 'POST', | |
| headers: { | |
| Authorization: `Basic ${btoa(`${CLIENT_ID}:${CLIENT_SECRET}`)}`, | |
| 'Content-Type': 'application/x-www-form-urlencoded', |