web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / The built-in template ...
Power Automate
Suggested Answer

The built-in template "Post to a channel when a webhook request is received" does not seem to work

(0) ShareShare
ReportReport
Posted on by 2
after using the built-in template "Post to a channel when a webhook request is received" I get an error after testing the Workflow by sending a webhook POOST with Python.
 
 
This is the script I am using although I have redacted the complete URL:
 
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}")
Is there something wrong with the template? Or is there something wrong with my script?
Categories:
I have the same question (0)
  • Suggested answer
    wobY Profile Picture
    2 on at
    Hey there, I was having issues with this as well as the documentation for these is basically non-existent but I've figured it out. Here's what you need to do.
     
    Step 1:
    The body of the request needs to be in the below format:
    {
           "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)"
                        }
                    ]
                 }
              }
           ]
        }
     
    Step 2:
    You can use the Adaptive Cards Designer to create your Adaptive card: https://adaptivecards.microsoft.com/designer
     
    Then just replace the "content" JSON with your Adaptive Card JSON you created in the Designer. 
     
    Example:
    {
      "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
              }
            ]
          }
        }
      ]
    }
     
    Step 3 (if necessary):
    Additionally, if Flow bot is not in the channel you can switch the "Post as" to be "User" and then it will post the message as the user who create the Workflow

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard