Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

anderssonjohan commented Dec 4, 2013

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
You can’t perform that action at this time.