How to integrate Buddy with IFTTT to automatically create GitHub issues

How to integrate Buddy with IFTTT to automatically create GitHub issues

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

Hint

Actions used in this guide:

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:

    Image loading...Creating new applet in IFTTTCreating new applet in IFTTT

  2. Click +ifthis and look up Webhooks:

    Image loading...Adding webhooks to IFTTTAdding webhooks to IFTTT

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

    Image loading...Create a new triggerCreate a new trigger

  4. Click +that and look up GitHub:

    Image loading...Add a GitHub integrationAdd a GitHub integration

  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

      Image loading...Creating an issueCreating an issue

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

Image loading...Final reviewFinal review

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

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.

    Image loading...Creating a new pipelineCreating a new pipeline

  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.

    Image loading...Pipeline examplePipeline example

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

    http
    { "value1": "${execution.to_revision.revision}", "value2": "${execution.to_revision.committer.name}", "value3": "${execution.action_executions[0].log_url}" }
    ![Specifying IFTTT in the payload](/guides/images/ifttt/ifttt-9.png)
  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.

    Image loading...IFTTT webhook makerIFTTT webhook maker

  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:

Image loading...GitHub 'Issues' tabGitHub 'Issues' tab


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.

    Image loading...Adding variablesAdding variables

  3. When ready, click Add to save changes

This way, the Endpoint URL will look like this:

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

Jarek Dylewski

Jarek Dylewski

Customer Support

A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.