Closed johnlayton closed 2 months ago
There is no issue yet. This should add the option to post Blocks JSON to Slack;
Sample;
step "transform" "buckets" { value = jsondecode(<<EOT [ { "type": "section", "text": { "type": "mrkdwn", "text": "Pick an item from the dropdown list" }, "accessory": { "action_id": "select_bucket", "type": "static_select", "placeholder": { "type": "plain_text", "text": "Select a bucket...." }, "options": [ %{ for idx, name in step.pipeline.buckets.output.buckets[*].Name } { "text" : { "type" : "plain_text", "text" : "${name}" }, "value" : "${name}" } %{ if idx < length(step.pipeline.buckets.output.buckets[*].Name) - 1 },%{ endif } %{ endfor } ] } } ] EOT ) } step "pipeline" "post_message" { pipeline = slack.pipeline.post_message args = { channel = "test" blocks = jsonencode(step.transform.buckets.value) } }
Result;
step "pipeline" "post_message" { pipeline = slack.pipeline.post_message args = { channel = "test" blocks = jsonencode([ { "type" : "section", "block_id" : "section678", "text" : { "type" : "mrkdwn", "text" : "*This is a bold text block*" } }, { "type" : "section", "block_id" : "section679", "text" : { "type" : "plain_text", "text" : "This is a plain text block" } }, { "type": "section", "block_id" : "section680", "text": { "type": "mrkdwn", "text": "This is a section block with an accessory image." }, "accessory": { "type": "image", "image_url": "https://pbs.twimg.com/profile_images/625633822235693056/lNGUneLX_400x400.jpg", "alt_text": "cute cat" } } ]) } }
Produces;
Thanks @johnlayton for the enhancement 👍 !!
Following the above sample, could you please add a sample output/screenshot of how the block appears on slack?
Checklist
There is no issue yet. This should add the option to post Blocks JSON to Slack;
Sample;
Result;
Sample;
Produces;