slack-github-action icon indicating copy to clipboard operation
slack-github-action copied to clipboard

Make payload delimiter configurable

Open rzumer opened this issue 1 year ago • 5 comments

Fixes #280.

Summary

The default key delimiter when flattening payloads is a period, which is not allowed in Slack workflow variable keys. This makes the slack-send action unusable with Slack workflows/incoming webhooks if the payload contains nested keys as there is no way to access those keys (as far as I can tell).

For example if I want to include workflow metadata from GitHub in my payload with ${{ toJson(github) }}, all nested keys are inaccessible, and if I want to compose this with other custom variables by nesting the serialized github values like "github": ${{ toJson(github) }}, "some-key": "some-value", then all of the GitHub metadata is inaccessible because it's all prefixed with github. and can't be entered as a variable key in a Slack workflow. Underscores and hyphens are both valid, so changing to an underscore makes all those nested keys accessible. See flat docs

Tested on a private workflow by building and calling the action directly from my branch.

This leaves the default as a period but allows users to override it by setting the payload-delimiter option alongside the payload sent to the action.

Requirements (place an x in each [ ])

rzumer avatar Jan 17 '24 20:01 rzumer

Thanks for the contribution! Before we can merge this, we need @rzumer to sign the Salesforce Inc. Contributor License Agreement.

salesforce-cla[bot] avatar Jan 17 '24 20:01 salesforce-cla[bot]

👋 Following up from #280 - I haven't heard of any immediate plans to support dot notation from Workflow Builder so I'm thinking this change is the right way to handle nested payloads going forward.

Since this can change key values of webhook inputs I believe this is a breaking change and will plan to include it in the next major version. Really appreciate the patience on introducing this change so far. We'll take a look at other possible changes we might want to include in a major version before merging this, but please know it's not forgotten!

zimeg avatar Apr 12 '24 01:04 zimeg

Thanks for the follow-up!

rzumer avatar Apr 12 '24 23:04 rzumer