IFTTT is one of the most popular services (if not the most popular) that you can use to create simple conditional statements for all your internet-connected things, including your favorite Continuous Delivery service.

In this guide we'll show you how to configure IFTTT to automatically create an issue in your GitHub repository when something wrong goes in the pipeline (eg. a build fails).

Create a new IFTTT applet

Let's starting with creating a new IFTTT applet that will act as a bridge between GitHub and Buddy:

  1. Login to your IFTTT profile, go to My Applets and create a New Applet

  2. Click +ifthis and look up Webhooks

  3. Click Receive a web request, set the event name (eg. build_failed), and click Create Trigger when done

  4. Click +that and look up GitHub

  5. Sign in to your GitHub account and authenticate IFTTT
  6. Click Create an issue and enter the details:

    • Repository where the issue will be created
    • Title of the issue
    • Body of the issue

    The examples above employ custom variables (ingredients) in the recipe. We'll configure them to send details about your execution in the next step.

  7. When ready, click Create action, review and Finish

Configure the webhook in Buddy

The applet is ready. Let's create a pipeline that will trigger the event in IFTTT and update the contents of the message with custom information:

  1. Add a new pipeline and set the Trigger mode to 'On every push'

  2. Add a build action for your type of application (eg. Node.js)
  3. Add Send HTTP request to 'Actions run on failure'. This way the request will be sent only if the primary action has failed.

  4. Enter the details of the IFTTT ingredient in the payload, for example:

    {
    "value1": "${execution.to_revision.revision}",
    "value2": "${execution.to_revision.committer.name}",
    "value3": "${execution.action_executions[0].log_url}"
    }
    

  5. In the Endpoint URL, paste the token from IFTTT. You can find it at the Webhook's maker page under Documentation in your IFTTT profile.

  6. Click Add this action when ready

Congratulations! You can use Buddy to automatically issue tasks in GitHub if something goes wrong. To test the action, try messing something up (eg. build commands) and make a push – if everything was configured correctly, a new issue will apear in GitHub:


Using environment variables to store IFTTT token

You can store the webhook token as a variable to use it in later on other actions:

  1. Go to the pipeline settings and click Variables
  2. Enter the Name for the variable (eg. IFTTT_TOKEN) and paste the Value.

  3. When ready, click Add to save changes

This way, the Endpoint URL will look like this:

https://maker.ifttt.com/trigger/build_failed/with/key/${IFTTT_TOKEN}

Summary

This is the first of the upcoming series of IFTTT recipies that we're planning to add. If you have an idea for a cool recipe for Buddy, feel free to drop a word to support@buddy.works.

Thanks for reading!