Skip to content

Instantly share code, notes, and snippets.

@KaiserWerk
Created January 10, 2018 10:52
Show Gist options
  • Save KaiserWerk/fa93c78192f2177769517c2ae36e59f0 to your computer and use it in GitHub Desktop.
Save KaiserWerk/fa93c78192f2177769517c2ae36e59f0 to your computer and use it in GitHub Desktop.
Send notification to HipChat Room
$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