Skip to content

IFTTT Example : Turn PC Speakers Off

This article explains how to create an IFTTT.

  1. Go to IFTTT.com and create a new applet. Start by searching for Webhooks

  2. Select Webhooks and then click on “Receive a web request”



  3. Enter an Event Name and then click on “Create trigger”.



  4. Click “+ That” to continue and add an action. That will bring up a bring “Choose Actions Service”. Search for Smart Life and click on that service.



  5. On the “Choose action” screen, select “Turn off”.



  6. Select the device that you want to turn off and then click on “Create action”.



  7. On the next screen, click on “Finish”  to create your applet which will be called “If Maker Event “PC Speakers OFF”, then turn off Computer Speakers”.



  8. To trigger an Event

    Make a POST or GET web request to:

    https://maker.ifttt.com/trigger/{event}/with/key/xxxxxxxxxxxx

    (The instructions here can be found in Webhooks Documentation.)

  9. Substitute the string “{event}” with the name of the applet that you created in step 7.
    You can use the https call in a JavaScript ajax call or directly in a PHP script.


Example Code:

HTML:

<!DOCTYPE html>
<html>
<body>
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js”></script>

<h1>Hello World</h1>

<script>

    $.ajax({
      method: “POST”,
      url: “http://davenotes.com/sites/extra/PC_Speakers_Off.php”,
    });
</script>

</body>
</html>

PHP:

<?
    //The URL that we want to GET.
    $url = “https://maker.ifttt.com/trigger/PC Speakers OFF/with/key/x-xxxxxxxxxxx”;
    //Use file_get_contents to GET the URL in question.
        $contents = file_get_contents($url);
?>