Created
January 10, 2018 10:52
-
-
Save KaiserWerk/fa93c78192f2177769517c2ae36e59f0 to your computer and use it in GitHub Desktop.
Send notification to HipChat Room
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = array( | |
'color' => 'purple', | |
'message' => 'Buy all ze things! (allthethings)', | |
'notify' => false, | |
'message_format' => 'text' | |
); | |
$ch = curl_init('https://<your_url>.hipchat.com/v2/room/<room_no>/notification?auth_token=<token>'); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); | |
$res = curl_exec($ch); | |
// log the result | |
file_put_contents('hipchat_hook.log', print_r($res, true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment