Skip to content

Commit

Permalink
Add send_slack_message_using_cron mod (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdatasourav authored Dec 5, 2023
1 parent 92ed6c5 commit 985e82d
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
8 changes: 8 additions & 0 deletions simple/send_slack_message_using_cron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Send Slack Message Using Cron

Send a message to a Slack channel every minute using cron.

## Usage

- Add your Slack API token, Channel and Message to `flowpipe.pvars`
- Run the `flowpipe server`
3 changes: 3 additions & 0 deletions simple/send_slack_message_using_cron/flowpipe.fpvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
slack_token = "xoxb-2556146250-5954"
slack_channel = "mychannel"
message = "test trigger 1 min"
13 changes: 13 additions & 0 deletions simple/send_slack_message_using_cron/mod.fp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mod "send_slack_message_using_cron" {
title = "Send Slack Message Using Cron"
description = "Send a message to a Slack channel every minute using cron."

require {
mod "github.com/turbot/flowpipe-mod-slack" {
version = "0.0.1-rc.2"
args = {
token = var.slack_token
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
trigger "schedule" "send_slack_message_using_cron" {
description = "Send a message to a Slack channel every minute using cron."
schedule = "* * * * *"
pipeline = pipeline.send_slack_message_using_cron
}

pipeline "send_slack_message_using_cron" {
title = "Send Slack Message Using Cron"
description = "Send a message to a Slack channel every minute using cron."

param "slack_token" {
type = string
description = "Authentication token bearing required scopes."
default = var.slack_token
}

param "slack_channel" {
type = string
description = "Channel, private group, or IM channel to send message to."
default = var.slack_channel
}

param "message" {
type = string
description = "Message to be sent."
default = var.message
}

step "pipeline" "post_message" {
pipeline = slack.pipeline.post_message
args = {
token = param.slack_token
channel = param.slack_channel
message = param.message
}
}
}
14 changes: 14 additions & 0 deletions simple/send_slack_message_using_cron/variables.fp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "slack_token" {
type = string
description = "Slack app token used to authenticate to your Slack workspace."
}

variable "slack_channel" {
type = string
description = "Channel, private group, or IM channel to send message to."
}

variable "message" {
type = string
description = "Message to be sent."
}

0 comments on commit 985e82d

Please sign in to comment.