Skip to main content

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.

  1. 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.

  2. Use the command by adding at least the two required parameters to it: workflow and branch.

    /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 or branch. For example, branch: main

  • w or workflow. 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 or tag. For example, branch: main|tag: v1.0

  • c or commit. For example, workflow: run_tests|commit: eee55509f16e7715bdb43308bb55e8736da4e21e

  • m or message. 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

Example 1. Slack command with all parameters included

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 of iPhone 6S.

  • $DEVICE_UDID with the value of 82667b4079914d4aabed9c216620da5dedab630a

/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