Skip to content

Instantly share code, notes, and snippets.

@strigona-worksight
Created February 4, 2016 19:21
Show Gist options
  • Save strigona-worksight/a715c9035e42aaf8cad5 to your computer and use it in GitHub Desktop.
Save strigona-worksight/a715c9035e42aaf8cad5 to your computer and use it in GitHub Desktop.
Delete pushes from a chat
# Deletes pushes from a chat with another contact
$targetContact = '[email protected]'
$batchSize = 50
$accessToken = 'xxxxxxx'
$headers = @{'Access-Token' = $accessToken }
Try
{
$pushesUrl = "https://api.pushbullet.com/v2/pushes?email=" + $targetContact + '&limit=' + $batchSize
$data = Invoke-RestMethod -Uri $pushesUrl -Headers $headers -ContentType 'application/json'
$pushes = $data[0].pushes
$i = 0
foreach ($push in $pushes)
{
$url = "https://api.pushbullet.com/v2/pushes/" + $push.iden
Try
{
Invoke-RestMethod -Method Delete -Uri $url -Headers $headers
}
Catch
{
$_.Exception.Message
Break
}
$i++
$i
}
"Done"
}
Catch
{
$_.Exception.Message
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment