diff --git a/CHANGELOG.md b/CHANGELOG.md index 6468f1f..ba7583f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## v0.2.0 [2024-02-07] + +_What's new?_ + +- Added pipeline `get_channel_id`. ([#17](https://github.com/turbot/flowpipe-mod-slack/pull/17)). + +_Bug fixes_ + +- Fixed the input parameters of the `test_post_message` pipeline. ([#17](https://github.com/turbot/flowpipe-mod-slack/pull/17)) + ## v0.1.0 [2023-12-14] _What's new?_ diff --git a/README.md b/README.md index 439af00..ba4b997 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,6 @@ Slack pipeline library for [Flowpipe](https://flowpipe.io), enabling seamless in ## Getting started -### Requirements - -Docker daemon must be installed and running. Please see [Install Docker Engine](https://docs.docker.com/engine/install/) for more information. - ### Installation Download and install Flowpipe (https://flowpipe.io/downloads). Or use Brew: @@ -100,7 +96,7 @@ flowpipe pipeline list Run a pipeline: ```shell -flowpipe pipeline run post_message -arg channel=test -arg text="Hello World" +flowpipe pipeline run post_message --arg channel=test --arg text="Hello World" ``` To use a specific `credential`, specify the `cred` pipeline argument: diff --git a/pipelines/channel/get_channel_id.fp b/pipelines/channel/get_channel_id.fp new file mode 100644 index 0000000..9322f51 --- /dev/null +++ b/pipelines/channel/get_channel_id.fp @@ -0,0 +1,23 @@ +pipeline "get_channel_id" { + title = "Get Channel ID" + description = "Get the ID from the channel name." + + param "cred" { + type = string + description = local.cred_param_description + default = "default" + } + + param "channel_name" { + type = string + description = "Name of the channel." + } + + step "pipeline" "list_channels" { + pipeline = pipeline.list_channels + } + + output "channel_id" { + value = [for channel in step.pipeline.list_channels.output.channels : channel.id if channel.name == param.channel_name][0] + } +} diff --git a/pipelines/chat/tests/test_post_message.fp b/pipelines/chat/tests/test_post_message.fp index ace4841..7fbf6e2 100644 --- a/pipelines/chat/tests/test_post_message.fp +++ b/pipelines/chat/tests/test_post_message.fp @@ -1,4 +1,4 @@ -// usage: flowpipe pipeline run test_post_message --pipeline-arg message="Hello World" +// usage: flowpipe pipeline run test_post_message --arg text="Hello from test_post_message" --arg channel="random" pipeline "test_post_message" { title = "Test Post Message" description = "Test the post_message pipeline." @@ -9,7 +9,7 @@ pipeline "test_post_message" { default = "default" } - param "message" { + param "text" { type = string default = "Hello World from test_post_message pipeline." description = "The formatted text of the message to be published." @@ -25,7 +25,14 @@ pipeline "test_post_message" { args = { cred = param.cred channel = param.channel - message = param.message + text = param.text + } + } + + step "pipeline" "get_channel_id" { + pipeline = pipeline.get_channel_id + args = { + channel_name = param.channel } } @@ -34,7 +41,7 @@ pipeline "test_post_message" { pipeline = pipeline.delete_message args = { cred = param.cred - channel = param.channel + channel = step.pipeline.get_channel_id.output.channel_id ts = step.pipeline.post_message.output.message.ts } }