Make payload delimiter configurable
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 [ ])
- [x] I've read and understood the Contributing Guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
Thanks for the contribution! Before we can merge this, we need @rzumer to sign the Salesforce Inc. Contributor License Agreement.
👋 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!
Thanks for the follow-up!