cloud-build-notifiers icon indicating copy to clipboard operation
cloud-build-notifiers copied to clipboard

SlackNotifier message notification popup says "no preview available" in Slack desktop client for Windows

Open andre-engelbrecht opened this issue 1 year ago • 2 comments

I've setup the SlackNotifier in my GCP build pipeline, everything is working pretty well but when messages come through in the Slack desktop client for Windows, the notification popup says "no preview available" even though the actual message in Slack appears fine.

enter image description here enter image description here

This seems to be due to the fact that in the WebhookMessage post, the "Text" property is not included and Windows / Slack (on Windows) not supporting rich-text content. Slack documentation suggests including the "Text" property in the payload which will be used as fallback when rich-text is not supported.

More details are available in the StackOverfow issue I posted: https://stackoverflow.com/questions/76657027/google-cloud-build-slack-notifier-message-no-preview-available

The posted answer explains the (suspected) problem and solution and he even created a fork with suggested code changes - https://github.com/onix/cloud-build-notifiers/commit/e83dab3997e1b187d2217086434289effc9b79b5

andre-engelbrecht avatar Jul 11 '23 21:07 andre-engelbrecht

It would be great to get this solved!

jkumara avatar Oct 24 '23 19:10 jkumara

I am getting the same thing [No preview available] in notification inside Fedora linux (using web browser slack app) and the same also applies to android mobile slack application.

Our slack json looks like this:

[
    {
        "type": "section",
        "text":
        {
            "type": "mrkdwn",
            "text": "Cloud Build in *{{.Build.ProjectId}}* for service *{{.Build.Substitutions._SERVICE_NAME}}* has finshed with status *{{.Build.Status}}*"
        },
        "accessory":
        {
            "type": "button",
            "text":
            {
                "type": "plain_text",
                "text": "Build Logs"
            },
            "value": "click_me_123",
            "style": "primary",
            "url": "{{.Build.LogUrl}}",
            "action_id": "button-action"
        }
    }
]

scr4bble avatar Apr 11 '24 15:04 scr4bble