Let’s automate together! Bitrise + IFTTT=⚙

Bitrise finds challenges in automation. Do you?

We’re almost sure you’ve used IFTTT (turning one’s phone ringer volume up FTW), but have you ever tried to use it with Bitrise? Let us give you some pointers to start on! We’ll show you two step by step guides how to use IFTTT with Bitrise:

  1. if your Bitrise build fails then IFTTT will send you an SMS
  2. if you press the Big Deploy Button on your phone then IFTTT will deploy your last build to App Store

1, Know instantly if a build fails

Let’s make IFTTT send you an SMS if your build fails!

On IFTTT

  1. After login, either click My Applets or your profile and click New Applet
  2. Click +this and search for Webhooks

3. Select Receive a web request

4. Set event name (e.g. build_failed) and Create trigger

5. Click +that and select SMS

6. Select SMS

7. Set a message, for example: Sorry, your build has failed. Why not try again?

8. You can add your build number too by inserting Value1 under Add ingredient: Sorry, your #{{Value1}} build has failed. Why not try again?

9. Create action, review and Finish

On Bitrise:

  1. Go to your selected app’s Workflow Editor and after the last step, click + and add a Script
  2. Turn on Run if previous step failed, to make sure this runs in all cases and replace the script in the textbox with the following:

curl -X POST -H "Content-Type: application/json" -d '{"value1":$BITRISE_BUILD_NUMBER}' https://maker.ifttt.com/trigger/build_failed/with/key/$IFTTT_TOKEN

3. You can find the token at the Webhook’s maker page under Documentation.

4. Add this token as an Environment Variable to Bitrise in your Workflow Editor with the name IFTTT_TOKEN

5. Save and you are done!

You’ll get an SMS when your build fails. We hope you won’t get (m)any! 👻

2, Big Deploy Button

How about a Big Deploy Button? You could deploy your last release straight to App Store. Do it yourself!

On Bitrise:

  1. Log in and select your app. Click Start/Schedule a Build in the top right corner.
  2. Choose Advanced, select your preferred brach and the deployment workflow.
  3. Find the cURL command at the bottom of the popup and save it somewhere. You will need this later.

On IFTTT:

  1. After login, either click My Applets or your profile and click New Applet
  2. Click +this and search for Button widget. Select it and then Button press
  3. Click +that and search for Webhooks. Select it and then click Make a web request
  4. Copy and paste your cURL from (see 3. above)
  5. Set Method: Post and Content Type: application/json
  6. Copy the build parameters following data from your app's cURL command (see 3. above) and insert it to Body. Change "triggered by" parameter to "ifttt"
  7. Create action, name your applet (e.g. Deploy with Bitrise or Big Deploy Button) and Finish

You are almost done :)

On your phone:

  1. Install the IFTTT application and log in (Google Play, App Store
  2. Add widget to your home screen: IFTTT small
  3. Choose your applet (e.g. Deploy with Bitrise or Big Deploy Button)
  4. Press it and 🎉

Think on!

Similarly, you could track all your builds in a Google Spreadsheet and have all the details there: project and build number, build time, success, status, etc. Or…

Do you have another IFTTT applet for Bitrise? Share it with us!

Originally published at http://blog.bitrise.io/2017/07/20/ifttt-bitrise-magic.html on July 20, 2017.