import requests
import json
# Define the Jira webhook URL
webhook_url = 'https://prod-86.westeurope.logic.azure.com:443/<...REDACTED...>'
# Sample payload to simulate a Jira webhook event
# Customize the payload according to the expected data structure
payload = {
"timestamp": "2024-10-23T10:00:00Z",
"webhookEvent": "jira:issue_updated",
"issue": {
"id": "10001",
"key": "PROJECT-123",
"fields": {
"summary": "Test Issue Summary",
"status": {
"name": "In Progress"
},
"assignee": {
"displayName": "John Doe"
}
}
},
"user": {
"name": "user_name",
"emailAddress": "user@example.com",
"displayName": "User Full Name"
}
}
# Optional headers (if your webhook requires authentication or specific content type)
headers = {
'Content-Type': 'application/json',
# 'Authorization': 'Bearer your_token_if_required'
}
# Send POST request to Jira webhook
try:
response = requests.post(webhook_url, headers=headers, data=json.dumps(payload))
# Check response status
if response.status_code == 200:
print("Webhook test successful!")
print(f"Response: {response.text}")
else:
print(f"Failed to trigger webhook. Status code: {response.status_code}")
print(f"Response: {response.text}")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")

Report
All responses (
Answers (