0
votes

I'm trying to use ADFv2's web hook functionality to send a message to Teams using the Office 365 connector card.

I have setup a webhook in Teams and can successfully send simple JSON payloads from ADF

for example

{"text":"Hello World!"}

But if I try the Office 365 Connector message example from the documentation ADFv2 does not recognize the payload as being valid JSON.

Anyone have any idea how I can structure the json message below in a way that ADFv2 will accept?

I've tried - building the string dynamically and wrapping in @json function - which complains that the passed string is not valid json - removing the @ symbol - which gives a bad request error

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Larry Bryant created a new task",
    "sections": [{
        "activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task",
        "activitySubtitle": "On Project Tango",
        "activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
        "facts": [{
            "name": "Assigned to",
            "value": "Unassigned"
        }, {
            "name": "Due date",
            "value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
        }, {
            "name": "Status",
            "value": "Not started"
        }],
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "ActionCard",
        "name": "Add a comment",
        "inputs": [{
            "@type": "TextInput",
            "id": "comment",
            "isMultiline": false,
            "title": "Add a comment here for this task"
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Add comment",
            "target": "http://..."
        }]
    }, {
        "@type": "ActionCard",
        "name": "Set due date",
        "inputs": [{
            "@type": "DateInput",
            "id": "dueDate",
            "title": "Enter a due date for this task"
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Save",
            "target": "http://..."
        }]
    }, {
        "@type": "ActionCard",
        "name": "Change status",
        "inputs": [{
            "@type": "MultichoiceInput",
            "id": "list",
            "title": "Select a status",
            "isMultiSelect": "false",
            "choices": [{
                "display": "In Progress",
                "value": "1"
            }, {
                "display": "Active",
                "value": "2"
            }, {
                "display": "Closed",
                "value": "3"
            }]
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Save",
            "target": "http://..."
        }]
    }]
}
1
ADFv2 don't support Message Card, they support simple JSON. Message card supposed to work for Incoming webhook created within Teams or outlook. YouTrinetra-MSFT

1 Answers

0
votes

As Trinetra-MSFT answered :-

"ADFv2 don't support Message Card, they support simple JSON. Message card supposed to work for Incoming webhook created within Teams or outlook."