Skip to content

Instantly share code, notes, and snippets.

@markekraus
Last active March 15, 2018 15:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markekraus/1a8d06bb54691161f2500180ee55de71 to your computer and use it in GitHub Desktop.
Save markekraus/1a8d06bb54691161f2500180ee55de71 to your computer and use it in GitHub Desktop.
Install-Module PSRAW -Scope CurrentUser
Import-Module PSRAW
# Go here https://ssl.reddit.com/prefs/apps
# use https://127.0.0.1 for redirect uri
# register Script App and note client id and secret
Connect-Reddit
$Params = @{
Uri = 'https://oauth.reddit.com/api/compose'
Method = 'POST'
Body = @{
'api_type' = 'json'
'subject' = 'Test Message'
'text' = 'This is a test from PSRAW!'
'to' = 'SomeRedditUser'
}
ContentType = 'application/x-www-form-urlencoded'
}
$result = Invoke-RedditRequest @params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment