dchaley / deepcell-imaging

Tools & guidance to scale DeepCell imaging on Google Cloud Batch
8 stars 2 forks source link

Add a Teams-formatted webhook call on pipeline success #283

Open dchaley opened 1 month ago

dchaley commented 1 month ago

While we work through the bigger picture of notifications, we can at least build support for calling a Teams webhook. The webhook body format is a bit specific & non-obvious, see this comment.

We should provide at least this information in the message:

dchaley commented 1 month ago

Note on getting rid of the message: "X used a workflow template etc" – according to this thread, we need to create the workflow from scratch. Womp womp. (But at least it's not part of how we call the webhook.)

dchaley commented 1 month ago

The text body supports some markdown (docs, card schema) – this json sends a hyperlink!

{
    "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": "Sample Text Again! [link to google!](http://google.com)"
                    }
                ]
            }
        }
    ]
}

Screenshot of card w/ hyperlink:

Screenshot 2024-07-19 at 1 42 07 PM
dchaley commented 1 month ago

Bumping this back to 'Waiting' because this finish notification will go somewhere in #292, #293, #294