Skip to content

Instantly share code, notes, and snippets.

View pmsudhi's full-sized avatar

Sudheesh PM pmsudhi

View GitHub Profile
@pmsudhi
pmsudhi / sentry_mattermost_webhook.php
Created March 22, 2022 06:57 — forked from dkmonaghan/sentry_mattermost_webhook.php
This script can act as a middleman between Sentry's webhook system and Mattermost's Incoming Webhooks
<?php
$json = json_decode(file_get_contents('php://input'), true);
if ($json['action'] !== 'created'){ die('Only create actions are alerted'); }
$error = $json['data']['issue'];
if ($error['project']['id'] == 1){ die('Ignore internal errors.'); }
if (empty($error['shortId'])){ die('No shortId passed'); }
// Set channel and username