https://github.com/noook/google-home-webhooks
Webhook server for IFTTT services triggered by Google Home
https://github.com/noook/google-home-webhooks
golang google-home ifttt ifttt-webhooks wakeonlan
Last synced: about 1 year ago
JSON representation
Webhook server for IFTTT services triggered by Google Home
- Host: GitHub
- URL: https://github.com/noook/google-home-webhooks
- Owner: noook
- Created: 2020-05-14T20:51:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T16:11:35.000Z (about 6 years ago)
- Last Synced: 2025-02-09T04:28:00.023Z (over 1 year ago)
- Topics: golang, google-home, ifttt, ifttt-webhooks, wakeonlan
- Language: Go
- Size: 4.58 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Home Webhooks
## Context
I just bought a Google Home Mini, and was wondering what was possible to make with it.
The goal was mainly to trigger code behind voice, so I tried to trigger something that I already
do through CLI: turning on my computer remotely with a WakeOnLAN.
I also heard about [IFTTT](https://ifttt.com) that allows you to automate a lot of things,
and an interesting feature is the webhooks. They allow me to make HTTP requests with JSON body
to a given URL, when an event (Google Home action) occurs.
## Idea
Webhooks are not secure, and everybody with the URL can trigger it, so I had to find a way
to be authenticated so only IFTTT can make requests. So I created a command that generates
a [JWT](https://en.wikipedia.org/wiki/JSON_Web_Token) that also attaches data to it. So when
the webhook receives the request, I can verify that I am the creator of the token, and can also
read what's inside it. In this example, I'm attaching the MAC address of my computer.
## Usage
Setup your environment variables either by exporting it in your shell or by creating a `.env` file.
You need to fill in the `JWT_SECRET` and `SERVER_PORT` variables.
You can build the command then run it with :
```sh
go build -o ifttt-wol
./ifttt-wol generate
# ey.................
```
Keep this token and configure your IFTTT action, then pass the token in the `POST` request JSON
payload:
```json
{
"token": ""
}
```
Then run the server with
```sh
./ifttt-wol server
```
Your server is ready to accept hooks !