Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newbie Hipchat #26

Open
kiquenet opened this issue May 27, 2016 · 1 comment
Open

Newbie Hipchat #26

kiquenet opened this issue May 27, 2016 · 1 comment

Comments

@kiquenet
Copy link

Suggestion: working together with https://github.com/hugorodgerbrown/HipChat.net

Question: Can I use Hipchat and Powershell like Slash ?

https://gist.github.com/magnetikonline/11007e42d86f490b84f8

https://github.com/jgigler/Powershell.Slack/blob/master/Send-SlackMessage.ps1

http://geeks.ms/enterprise/2016/02/15/monitorizar-eventos-con-powershell/

function Send-SlackMessage([string]$message, [string]$userName, [string]$channel="#tests"){
$postSlackMessage = @{token="EL_TOKEN_SLACK_VIENE_AQUI";channel=$channel;text=$message;username=$userName;icon_url="ICONO.png"}
$body = Invoke-RestMethod -Uri https://slack.com/api/chat.postMessage -Body $postSlackMessage -method Post
}

$time=Get-Date
$time=$time.addHours(-1)
$section="Application"
$errors = get-EventLog -LogName $section -EntryType Error -After $time -Source "Application Error"

$errors | foreach {
$username=$env:computerName+": "+($.Source)+"(ID "+($.InstanceID)+")"
write-host $username
write-host "--------------------------------"
write-host $.Message
send-SlackMessage -message $
.Message -userName $username -channel "#tests"
}

@KyleGobel
Copy link
Owner

When I started this project the other implementation (https://github.com/hugorodgerbrown/HipChat.net) used the v1 api. This uses the v2 api.

Unfortunately though I'm in a similar situation as him.

The company I work for has switched to slack instead of hipchat, so I literally never use hipchat anymore, which makes adding things or changing things much harder.

I've never created powershell snap-ins before, but it's all .net I believe and would be pretty easy to call this library (or just use the raw REST API) from powershell.

I do not know how to do this off hand though :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants