Skip to content

Instantly share code, notes, and snippets.

@drlongnecker
Created January 16, 2012 18:55
Show Gist options
  • Save drlongnecker/1622328 to your computer and use it in GitHub Desktop.
Save drlongnecker/1622328 to your computer and use it in GitHub Desktop.
Posting to Campfire from PowerShell
param (
[string]$RoomNumber = (Read-Host "The room to post to (default: 123456) "),
[string]$Message = (Read-Host "The message to send ")
)
$defaultRoom = "123456"
if ($RoomNumber -eq "") {
$RoomNumber = $defaultRoom
}
$authToken = "YOUR AUTH TOKEN"
$postUrl = "https://YOURDOMAIN.campfirenow.com/room/{0}/speak.json" -f $RoomNumber
$data = "`"{'message':{'body':'From PowerShell: - " + $message'}}`""
$command = "curl -i --user {0}:X -H 'Content-Type: application/json' --data {1} {2}" -f $authToken, $data, $postUrl
$result = Invoke-Expression ($command)
if ($result[0].EndsWith("Created") -ne $true) {
Write-Host "Error!" -foregroundcolor red
$result
}
else {
Write-Host "Success!" -foregroundcolor green
}
@anderssonjohan
Copy link

Thanks!

Need support for sound messages? We've got it!

https://github.com/remotex/Scripts/blob/master/SendTo-Campfire.ps1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment