1. Go to this page and download the library: Download stichoza/jira-webhooks-data library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stichoza / jira-webhooks-data example snippets
// Example payload received from Jira webhook
$data = [
"timestamp" => 1629835026055,
"webhookEvent" => "jira:issue_updated",
// ... other webhook data ...
"issue" => [
// ... issue data ...
],
"changelog" => [
// ... changelog data ...
],
// ... other data ...
];
use Stichoza\JiraWebhooksData\Models\JiraWebhookData;
$webhookData = new JiraWebhookData($data);
$message = 'New comment by ' . $webhookData->comment->author->displayName
. ' on issue ' . $webhookData->issue->key;
. ': ' . $webhookData->comment->body;
if ($user) {
$userAccountId = $user->accountId;
$userDisplayName = $user->displayName;
// ... and other properties ...
}
$changelogId = $changelog->id;
$changelogItems = $changelog->items; // Array of JiraChangelogItem instances
// ... and other properties ...
if ($issue && $issue->isStatusResolved()) {
// Do something for resolved issues
}
if ($user && $user->active) {
// Do something for active users
}
use Stichoza\JiraWebhooksData\Models\JiraWebhookData;
use Stichoza\JiraWebhooksData\Exceptions\JiraWebhookDataException;
try {
$webhookData = new JiraWebhookData($data);
} catch (JiraWebhookDataException $e) {
// Handle the error
}
$to = $webhookData->issue?->assignee?->email;
if ($to !== null) {
// Do something
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.