Triggering builds by Slack commands
You can trigger Bitrise builds from your Slack workspace by configuring Slash Commands in your Slack apps. Each Bitrise app needs its own Slash Command.
-
Register the Bitrise webhook URL to your Slack app's Slash Command: Adding a Slack webhook.
Slack app reinstall
Creating a new Slash Command might require a reinstall of your Slack app.
-
Use the command by adding at least the two required parameters to it:
workflow
andbranch
./build-myapp workflow: run_tests|branch: main
You can set a number of different parameters in the command call, including a commit hash, and any Environment Variables that you want to pass on to the build. For more information on the available parameters, check out Available parameters for your Slack command.
Available parameters for your Slack command
To trigger builds via Slack, you need to amend your Slash Command with parameters in a key:value|key:value
format.
You must specify at least one parameter:
-
b
orbranch
. For example,branch: main
-
w
orworkflow
. For example,workflow: run_tests
Without specifying either branch or Workflow in your command, the command will fail.
The optional parameters allow further configuration of your build:
-
t
ortag
. For example,branch: main|tag: v1.0
-
c
orcommit
. For example,workflow: run_tests|commit: eee55509f16e7715bdb43308bb55e8736da4e21e
-
m
ormessage
. For example,branch: main|message: ship it!!
You can also send environment variables that will be available in your Workflow with the format: env[KEY1]:value1|ENV[KEY2]:value2
The example includes all parameters, required and optional. It builds a specific commit and passes two Environment Variables to the build:
-
$DEVICE_NAME
with the value ofiPhone 6S
. -
$DEVICE_UDID
with the value of82667b4079914d4aabed9c216620da5dedab630a
/build-myapp workflow: run_tests|b: main|tag: v1.0|commit:eee55509f16e7715bdb43308bb55e8736da4e21e|m: start my build!|ENV[DEVICE_NAME]:iPhone 6S|ENV[DEVICE_UDID]:82667b4079914d4aabed9c216620da5dedab630a