Slack
This filter allows you to send files, messages and download files from Slack.
It can be used alone or with the Slack Feeder to create a simple Slack bot for events API.
Parameters
The following parameters are required from this filter:
Parameter | Type | Default | Description |
---|---|---|---|
action | STRING | “send_message” | action to perform: “send_message”, “send_file”, “download_file”, “user_info” |
token | STRING | "" | Slack bot Token |
Each action
can use different parameters:
action = send_message
Parameter | Type | Default | Description |
---|---|---|---|
to | STRING | "" | channel ID or User ID that should receive the message (supports Golang templates) |
target | STRING | “main” | if text is not used you can choose which field of Message to use as text |
text | STRING | "" | you can define the text of the message to send (supports Golang templates) |
blocks | BOOL | false | if true you can use the Slack template blocks (block builder) |
action = send_file
Parameter | Type | Default | Description |
---|---|---|---|
to | STRING | "" | channel ID or User ID that should receive the message (supports Golang templates) |
target | STRING | “main” | if filename is not specified you can choose which field of Message has to be used as file content to send |
filename | STRING | "" | path of the file to send (supports Golang templates) |
action = download_file
Parameter | Type | Default | Description |
---|---|---|---|
url | STRING | "" | it should contain the Slack private url for the file download (supports Golang templates) |
target | STRING | “urlprivate” | if url is not specified you can choose which field of Message contains the Slack private url |
filename | STRING | "" | path of where to save the downloaded file. If not specified the file content will be inserted in the main field (supports Golang templates) |
action = user_info
Parameter | Type | Default | Description |
---|---|---|---|
target | STRING | “user” | this field has to contain the USERID |
In the output Message you can find all the user information returned by Slack:
user_id
user_teamid
user_name
user_deleted
user_color
user_realname
user_tz
user_tzlabel
user_tzoffset
user_profile
user_isbot
user_isadmin
user_isowner
user_isprimaryowner
user_isrestricted
user_isultrarestricted
user_isstranger
user_isappuser
user_isinviteduser
user_has2fa
user_hasfiles
user_presence
user_locale
user_updated
user_enterprise
... | slack(action="user_info", target="user") | slack(action="send_message", to="{{.channel}}", text="Hi {{.user_realname}}") | ...
... | random(output="random_num", min="9", max="90") | slack(action="download_file", filename="/tmp/store_{{ .random_num }}.data") | ...
Examples
Soon…