First, a brief explanation of what TRIGGERCMD is. To make it simple, this service allows you, with the help of an agent installed on your computer, to launch commands to perform actions on this computer. The interest here is to be able to do it with voice, thanks to Voiceflow and Alexa.
The principle is rather simple, you install software on your computer and send HTTP requests to trigger an action.
For this tutorial, I will explain how to put a Mac in sleep mode but you can run a multitude of other commands.
Let’s start by going to https://www.triggercmd.com to download the software to install (Windows, Linux, Mac).
Start by downloading the agent for your computer and while it is downloading, create an account by clicking on the link at the bottom of the page.
Install the software on your computer, launch it and log in with the IDs of the account you just created.
You will need a token when configuring the client on your computer, you can find it on this link:
Once the client is installed on your computer, you should see it listed on the list page with the following link:
Now we will create a command to put our Mac in sleep mode. To do this, click on the agent icon and select “GUI Command Editor”.
In the screen that appears, select “Add Command” from the left menu.
On the next screen, give a name to your command (Trigger) and add “pmset sleepnow” in the Command field. Click on “Save”.
The new command will appear on the Current Commands screen.
You can test it by hovering over its name on the screen and clicking on the play button.
You can close this window and, from the agent menu, click on “TRIGGERcmd.com”.
In the browser window that has just opened, click on “View Triggers”.
Now, for the “Sleep iMac” command, click on the “Bookmark” button
On the next window, click on “Generate Expiring URL”
Wait for the page to reload and copy the url from the url bar of your browser
The url should look something like: https://www.triggercmd.com/trigger/bookmark?token=eyJhbGciOiJIUzI1xxxxxxxxxxxxxxxxxxxxx
Keep this url on the side, we’re going to need it to trigger the command from Voiceflow.
Now that the configuration part is finished, connect to voiceflow and create a new skill.
I called mine “my computer” so that I could say “Alexa, ask my computer to go to sleep”.
Add an API block and paste the url you copied into the Endpoint URL. Keep GET as a method.
You can add an Intent block to use the one shot invocation name with your skill
In the end, your skill should look something like this.
All you have to do now is click on the “Upload to Alexa” button and test your skill from your Alexa device.
Well done! You can now control your computer by voice