How to use IFTTT with TRIGGERcmd


  • administrators

    This YouTube video shows and example using SmartThings -> IFTTT -> TRIGGERcmd:
    https://www.youtube.com/watch?v=dq-loAiKAgo&feature=youtu.be&t=345

    The example below lets you email trigger@applet.ifttt.com from your IFTTT account's email address to trigger commands.

    The email needs the computer name in the subject, and the trigger name in the body of the email.

    Example email

    Setup steps:

    1. Log into your IFTTT account.
    2. Go to https://ifttt.com/create.
    3. Click the "+ this" link.
    4. Type "email" and click Email.
    5. Click Send IFTTT any email.
    6. Click the "+ that" link.
    7. Type "webhooks" and click Webhooks.
    8. Click Connect.
    9. Click "Make a web request".
    10. Paste this whole line into the URL field:
      https://www.triggercmd.com/api/IFTTT?trigger={{Body}}&computer={{Subject}}
    11. Change the Method to POST.
    12. Change Content Type to "application/x-www-form-urlencoded".
    13. Change Body to:
      token=YourTokenFromTheInstructionsPage
    14. Click Create Action
    15. Click Finish

    You can use the same concept to trigger commands with other IFTTT services (instead of Email) too of course.

    I recommend you don't open your garage with a post on facebook.

    EDIT 9-2-17:
    See this article for how to pass parameters to your commands. You basically need to add another POST parameter called 'params' that contains your command parameters. You can put params in your URL with &params=russ.txt, or you can add &params=russ.txt to your IFTTT Body field.

    Like this, but don't put a carriage return between your token and the & even though it looks like there is one in this screenshot:
    paramsInBody

    This opens up a lot of possibilities. I just setup an IFTTT trigger to display on my PC any pictures I add to a Google Photos album.



  • I think you've got Subject and Body reversed because the computer name is in the subject.


  • administrators

    @trigFox , thank you for pointing that out! I fixed it. Now the screenshot matches the web request URL.



  • I'm new to this so sorry for the silly question...

    If I want to run a trigger from IFTTT, for example, a trigger called "spotify" (which works when I trigger it from the web page manually), I then use this for the URL:

    https://www.triggercmd.com/api/IFTTT?trigger=spotify

    and then later in the IFTTT webhook I set the body to:

    token=sdfhksdhfjkasdhfajksdfhajkhf.......... (whatever it is for my computer)


  • administrators



  • Thanks!! I try it when I get home tonight! Awesome app, BTW...


  • administrators

    Thank you. Let me know your results please.



  • Yep...it works. Thanks for the help!


  • administrators

    Here's another example.



  • This works great when I create a normal IFTTT. I'm having trouble making it work when the IFTTT is created on the platform for private apps with a maker account. with this, you can make multiple steps or "that's" (think IFTTTTTTTTTT). Even if I just create one "that" in the private app, I get an "action failed" on the webhook with triggercmd.. "unable to make web request. Your server returned a 401"
    any ideas or is this an issue with IFTTT?


  • administrators

    @delkem, I'll give it a try. It should work the same way.

    Method: POST
    Content type: x-www-form-urlencoded
    Body: token=(your token)

    One problem I've had before was I had a space in the body field that I didn't notice. That could cause that error.



  • @Russ Thank You!!! yes, it was a space at the end of the token


  • administrators

    @delkem, awesome! I'm glad that was it.



  • Hi,

    Am super-lovin' this :) :)

    However, and trying to configure an IFTTT Button Widget to kick-off a webhook to my PC (PC name R1) to run the Reboot in 10 seconds command, but keep getting 401 errors - please help.

    Am at the webhooks config page in IFTTT and entering the following:

    URL: https://www.triggercmd.com/api/IFTTT?trigger=reboot&computer=R1
    METHOD: POST
    CONTENT TYPE: x-www-form-urlencoded
    BODY: token=XYZ&params=russ.txt

    <obviously <XYZ> is my token ;)

    What am I doing wrong please ?

    Thanks so much,

    Dan



  • oops - that was for @Russ


  • administrators

    FYI, for anyone reading, @triggercmddm got it working. He needed to change the trigger name from 'reboot' to 'Reboot in 10 seconds' and he needed to remove '&params=russ.txt' from the body.

    URL: https://www.triggercmd.com/api/IFTTT?trigger=Reboot in 10 seconds&computer=R1
    BODY: token=XYZ


  • ...so just for the record and to complete the loop.
    @Russ just IM'd me and resolved the issue.
    Amazing service and phenomenal customer journey :)

    In brief, to reboot/restart your Windows 10 PC from an iOS Home Screen button click, do the following:

    1. Install TriggerCMD Agent
    2. Sign up/in to IFTTT
    3. For the If bit: select Button Widget
    4. For the Then bit: select webhooks and enter the following:
      i. URL: https://www.triggercmd.com/api/IFTTT?trigger=Reboot in 10 seconds&computer=R1
      ii. METHOD: POST
      iii. CONTENT TYPE: x-www-form-urlencoded
      iv. BODY: token=XYZ

    Notes:
    There are spaces in "Reboot in 10 seconds"
    My computer name is "R1"
    <obviously <XYZ> is my token

    To add the button widget to your iOS home screen:

    1. Tap the share icon (square with the up arrow)
    2. Tap "Add to Home Screen"
    3. Tap "Add"
    4. Enjoy :)


  • I know this is an old post, but I wanted to share what I intent to do in order to illustrate what can be done with a very practical example.
    I have a set of surveillance cameras. Some are indoor, some are outside. My associated software is iSpy. I also have a security system that only allows to get notifications via emails, as the Cie has its own proprietary surveillance system, at a different cost than mine (^_^). I want shut down the indoor and backyard cameras when I am in house, and turn them back on when I leave, or sleep, using the notification eMail. So, I plan on…

     Create 2 tasks conditions in IFTTT, for “Off” & “On”.
     Use <if><gmail> with proper filter on sender and subject), using respectively the words”Disarmed” & “Armed”.
     Use your method to trigger a batch commands to iSpy, that may look like this:
    URL: https://www.triggercmd.com/api/IFTTT?trigger=run ispy.exe "recordstop.alarmset"&computer=MyPC
    ... where alarmset is the set of cameras to stop in this case.
    I will keep you posted of the outcome.


  • administrators

    @rpondevie, good luck. That's a cool project. I suggest you make your IFTTT URL something like this:

    https://www.triggercmd.com/api/IFTTT?trigger=ispy&computer=MyPC&params=recordstop.alarmset
    

    Then make a command with these values:

    • Trigger = ispy
    • Command = c:\program files\ispy\ispy.exe (probably a different path)
    • Allow Parameters = true

Log in to reply
 

Looks like your connection to TRIGGERcmd Forum was lost, please wait while we try to reconnect.