Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add top-level variables to slack template in order to support slack's workflow builder #2607

Open
tran-christian opened this issue Dec 3, 2024 · 0 comments
Labels

Comments

@tran-christian
Copy link

tran-christian commented Dec 3, 2024

Related to

Service (scheduled tasks, alerts)

Impact

major improvement to user experience

Missing Feature

Add webhook support for slack's builtin workflow builder. The workflow builder only has access to top-level fields of the incoming payload.

It would allow users to easily add webhooks to slack using the builtin workflow builder without having to create or use a third party app where there may also be restrictions in enterprise environments.

Implementation

Add all variables such as title, title_link, text, color, author, version to the top-level for the slack payload. We can still retain the existing variables such as attachments and fields so it does not break existing webhook implementations.

Design

Perhaps the slack.tmpl could be updated to something like this or similar.

{
    "title": "Task: {{ .Name }}",
    "title_link": "{{ .Task.URL }}",
    "text": "execution #{{ .Task.ID }}, status: {{ .Task.Result }}!",
    "color": "{{ .Color }}",
    "author" : "{{ .Author }}",
    {{ if .Task.Version }}
    "version": "{{ .Task.Version }}",
    {{ end }}
    "attachments": [
        {
            "title": "Task: {{ .Name }}",
            "title_link": "{{ .Task.URL }}",
            "text": "execution #{{ .Task.ID }}, status: {{ .Task.Result }}!",
            "color": "{{ .Color }}",
            "mrkdwn_in": [
                "text"
            ],
            "fields": [
                {
                    "title": "Author",
                    "value": "{{ .Author }}",
                    "short": true
                {{ if .Task.Version }}
                },
                {
                    "title": "Version",
                    "value": "{{ .Task.Version }}",
                    "short": true
                {{ end }}
                }
            ]
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant