LSTANCZYK
1/25/2016 - 6:38 PM

HipChat notification of new App Veyor deployment

HipChat notification of new App Veyor deployment

[cmdletbinding()]
		Param(
			[Parameter(Position = 0,Mandatory = $True )]
				[string]$apitoken,
			[Parameter(Position = 1,Mandatory = $True )]
				[string]$roomid			
			)

process {
$json="
 {
  `"color`": `"purple`", 
  `"message_format`": `"text`", 
  `"card`" : {
    `"style`": `"application`",
    `"format`": `"medium`",
    `"url`" : `"https://ci.appveyor.com/project/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG`",   
    `"id`": `"$env:APPVEYOR_BUILD_ID`",
    `"title`" : `"New Deployment`",
    `"icon`": {
      `"url`": `"http://softwaremanagementblog.net/wp-content/uploads/2015/05/icon_deployment-300x300.png`"
    },
    `"attributes`": [
        {
        `"label`": `"Application`",
        `"value`": {
          `"label`": `"$env:APPVEYOR_PROJECT_NAME`",
          `"style`":`"lozenge-current`"
          
        }
      },
      {
        `"label`": `"Version`",
        `"value`": {
          `"label`": `"$env:APPVEYOR_BUILD_VERSION`",
          `"style`":`"lozenge-success`"
        }
      },
  
      {
        `"label`": `"Commit`",
        `"value`": {
          `"label`": `"$env:APPVEYOR_REPO_COMMIT - $env:APPVEYOR_REPO_COMMIT_AUTHOR: $env:APPVEYOR_REPO_COMMIT_MESSAGE`"
        }
      }
    ]
  },
  `"message`": `"New deployment for $env:APPVEYOR_PROJECT_NAME`",
  `"from`":`"Deployment`",
  `"notify`":`"true`"
}
"
Invoke-WebRequest -Uri https://api.hipchat.com/v2/room/$roomid/notification?auth_token=$apitoken -Method Post -ContentType 'application/json' -Body $json

}