Examples

Action usage examples

Examples give users ideas on actual usage. We use automation to generate, test, and run these actions, so names and combinations may be odd or repetitive (wink). In many cases, other actions or environmental setup is required for the action to run, so you will need to adjust the action parameters and setup appropriate for your environment. 

Command line environments can be different, especially between Windows and non-Windows systems. Our Tips page talks about command line escaping differences and there are differences with respect to environment variable references ($ for non-Windows and %...% for Windows). These differences can impact examples, so recognize and adjust for your platform. In particular, all examples here are run with the standard bash shell on Linux.



addFile

--action addFile --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/messages.txt" --channel "zslackclichat1" --text "This is the *message* for 2222671"
--action addFile --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/messages.txt" --fileName "Important information"
--action addFile --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/photo.png" --channel "zslackclichat1" --text "This is the *message* for 2222671"

archiveChannel

--action archiveChannel --channel "zslackclichannels2" --continue

getChannel

--action getChannel --channel "general" --dateFormat "yyyy-MM-dd'T'HH:mm:ss.SSSZ"

getChannelHistoryList

--action getChannelHistoryList --channel "zslackclichat1" --dateFormat "yyyy-MM-dd HH:mm:ss" --limit 10
--action getChannelHistoryList --channel "zslackclichat1" --regex "(?s)((Lead text before code block:.*)|(\\`\\`\\`.*\\d{2}\\.\\d{2} \\d{2}:\\d{2} ((SUCCESSFUL)|(FAILED)).*\\`\\`\\`))" --limit 4 --outputType "text" --columns "id,message" --options "tableNoWrap"
--action getChannelHistoryList --channel "zslackclichat1" --regex "(?s).*2222671.*file line \\d+.*" --dateFormat "yyyy-MM-dd HH:mm:ss" --limit 1
--action getChannelHistoryList --channel "zslackclichat1" --regex "This is the \\*message\\* for 2222671.*?" --from "2022-08-01" --dateFormat "yyyy-MM-dd HH:mm:ss" --outputType "text" --columns "-blocks,user,subtype" --limit 20 --options "tableNoWrap"
--action getChannelHistoryList --channel "zslackclicontent" --dateFormat "yyyy-MM-dd HH:mm:ss" --outputType "text" --columns "-channel,Blocks" --limit 4 --options "tableNoWrap"
--action getChannelHistoryList --channel "zslackclicontent" --dateFormat "yyyy-MM-dd HH:mm:ss" --outputType "text" --columns "id,created,type,message,blocks" --regex ".*\"text\".*" --limit 2 --options "tableNoWrap"

getChannelList

--action getChannelList --includePrivate --includeArchived --dateFormat "yyyy-MM-dd"
--action getChannelList --regex "zslackclichannels.*" --outputFormat 999 --dateFormat "yyyy-MM-dd"

getFileList

--action getFileList --channel "zslackclichat1" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getFileList --limit 3 --dateFormat "yyyy-MM-dd HH:mm:ss" --regex "Important.*"

getServerInfo

--action getServerInfo --outputFormat 2

renderRequest

--action renderRequest --url "api/auth.test"

run

--action run --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/run.txt"
--action run --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/runWithFindReplace.txt" --findReplace "##action##:getServerInfo"
--action run --input "-a getChannelList --columns id,name,created --limit 4 --outputType slack --comment \"header text\" --channel zslackclichat1 --options site=slack_test" --input "-a getMessage --channel zslackclichat1 --id @last"

runFromChannelHistoryList

--action runFromChannelHistoryList --channel "zslackclichat1" --regex "(?s)((Lead text before code block:.*)|(\\`\\`\\`.*\\d{2}\\.\\d{2} \\d{2}:\\d{2} ((SUCCESSFUL)|(FAILED)).*\\`\\`\\`))" --from "%now%" --dateFormat "yyyy" --options "parallel" --limit 4 --common "-a getMessage --channel \"@channel@::@channelId@\" --id @messageId@"

runFromChannelList

--action runFromChannelList --options "parallel" --common "-a getChannel --channel @channelId@"

runFromFileList

--action runFromFileList --limit 2 --common "-a getFileList --regex \"@file@\" --limit 3"

runFromList

--action runFromList --list "Client, Server" --common "-a get@entry@Info"

runFromSql

--action runFromSql --sql "select '--action getServerInfo' as cmd" --common "@cmd@" --database "@database-test"

sendMessage

--action sendMessage --channel "zslackclichat1" --content "This is the *message* for 2222671 using content" --content "more content"
--action sendMessage --channel "zslackclichat1" --text "This is the *message* for 2222671 using text"
--action sendMessage --channel "zslackclicontent" --content "[ {\"type\": \"context\", \"elements\": [{\"type\": \"mrkdwn\", \"text\": \"Reported from https://bamboo.examplegear.com\"} ] } ] "
--action sendMessage --channel "zslackclicontent" --content "[ {\"type\": \"section\", \"text\": { \"text\": \"This is the message for 2201896\", \"type\": \"mrkdwn\" } } ]"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/content1.json" --channel "zslackclicontent"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/content2.json" --channel "zslackclicontent" --content "before2" --content "after2"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/content3.json" --channel "zslackclicontent" --content "*before3*" --content "*after3*" --content "*more* after3" --options "markdown"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/messages.txt" --channel "zslackclichat1" --text "This is the *message* for 2222671 with file data:"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/messages.txt" --channel "zslackclichat1" --text "This is the *message* for 2222671 with file data:" --replace
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/messages.txt" --channel "zslackclichat1" --text "This is the *message* for 2222671 with file data:" --replace --pin
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/status.txt" --channel "zslackclicontent" --options "markdown=code"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/status2.txt" --channel "zslackclichat1"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/status2.txt" --channel "zslackclichat1" --autoSplit --text "Lead text before code block:" --options "markdown=code"
--action sendMessage --file "/opt/atlassian/pipelines/agent/build/src/itest/slack/resources/status2.txt" --channel "zslackclichat1" --autoSplit --text "Lead text before code block:" --options "markdown=code,autoSplitHeadingCount=1" --quiet

unarchiveChannel

--action unarchiveChannel --channel "zslackclichannels2"
--action unarchiveChannel --channel "zslackclichannels2" --continue

Log a request with our support team.

Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.