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}")
{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "TextBlock",
"text": "For Samples and Templates, see [https://adaptivecards.io/samples](https://adaptivecards.io/samples)"
}
]
}
}
]
}
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": {
"type": "AdaptiveCard",
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "**🤖 Test subject**",
"wrap": true
},
{
"type": "TextBlock",
"text": "Test text here",
"wrap": true
}
]
}
}
]
}
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492