Slack

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:

ParameterTypeDefaultDescription
actionSTRING“send_message”action to perform: “send_message”, “send_file”, “download_file”, “user_info”
tokenSTRING""Slack bot Token

Each action can use different parameters:

action = send_message

ParameterTypeDefaultDescription
toSTRING""channel ID or User ID that should receive the message (supports Golang templates)
targetSTRING“main”if text is not used you can choose which field of Message to use as text
textSTRING""you can define the text of the message to send (supports Golang templates)
blocksBOOLfalseif true you can use the Slack template blocks (block builder)

action = send_file

ParameterTypeDefaultDescription
toSTRING""channel ID or User ID that should receive the message (supports Golang templates)
targetSTRING“main”if filename is not specified you can choose which field of Message has to be used as file content to send
filenameSTRING""path of the file to send (supports Golang templates)

action = download_file

ParameterTypeDefaultDescription
urlSTRING""it should contain the Slack private url for the file download (supports Golang templates)
targetSTRING“urlprivate”if url is not specified you can choose which field of Message contains the Slack private url
filenameSTRING""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

ParameterTypeDefaultDescription
targetSTRING“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