AWX Microsoft Teams Webhook Notification Issue

Hello,
I’m experiencing an issue with sending notifications to a Microsoft Teams channel using a webhook connection. I received the following error: “Error sending webhook notification: 400.” Strangely, I can send messages to the channel through Mattermost, but I’m unable to do so via the webhook. I’m currently using the latest version of AWX (23.3.1). Could you please assist me in resolving this problem?

Hello @tom1,
We’re so excited for your first post! Welcome to Forum :smile_cat:

May we ask why you want to use webhook rather than Mattermost? We would like to gain a better understanding of the issue you have described.

Thank you for your time!

Hey @djyasin ,

I had the same issue
I want to use webhook to configure adaptive cards for teams notifications for the job status notifications. For ex if a job fails I want to mention/tag and notify a particular user. How to achieve this?

I want to know if the 400 error is related to http_headers if not what else might me causing this issue?

1 Like

@djyasin or @tom1 or @suhasramanand any luck on this? Im running into the same issues - i found a work around but it looks like garbage in our teams channel (flat text, no hyperlinks, etc)

I know this is an old issue but I recently configured a webhook notification in AWX and the test feature was failing. Apparently this is a known issue where the test functionality ignores the customised message body provided. Notification webhook test feature sending its own format · Issue #8798 · ansible/awx · GitHub

Hello - yes i have resolved the webhook notification feature for MS Teams. First - create your workflow in MS Teams:

Go to the channel you want to post in - click the 3 dots and select Workflows - search “Post to a channel when a webhook request is received”

Next - pick your team and channel:

Create - C+P URL - click done

Login to AWX - Notification type - Webhook - do your name and description- C+P the webhook url for Target URL and use HTTP POST Method

This is what I am using for my payload as an example for the “Start Message Body”:

{
    "type": "message",
    "attachments": [
        {
    "contentType": "application/vnd.microsoft.card.adaptive",
    "content": {
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.4",
        "body": [
            {
                "type": "TextBlock",
                "text": "Ansible Playbook Status",
                "weight": "Bolder",
                "size": "Large"
            },
            {
                "type": "TextBlock",
                "text": "The playbook has completed execution.",
                "isSubtle": true
            },
            {
                "type": "TextBlock",
                "text": "Playbook Status: {{ job.status }}",
                "wrap": true
            },
            {
                "type": "TextBlock",
                "text": "Playbook Name: {{ job.name }}",
                "wrap": true
            }
        ],
        "actions": [
        {
            "type": "Action.OpenUrl",
            "title": "View Details",
            "url": "{{ url }}"
                }
            ]
        }
        }
    ]
}

Test a job - i use a simple win_ping playbook for testing this type of stuff and it should work:

If something isnt working - I would check your connections in your workflow that you are using