LIFX Developer Zone

Trying to pulse lights with IFTTT and Webhooks

I’m making myself crazy trying to make a group of my lights pulse between two colors, using IFTTT so that if the button press action is done, it makes a webhooks request.

In the webhooks request, I have these set:
URL: Bedroom/effects/pulse
Method: POST
Content type: "application/json"
-H "Authorization: Bearer MY_TOKEN" -d '{"color":"orange", "from_color":"blue", "cycles":"3", "persist":"false", "power_on":"true"}'

I have reformatted that body section in every way that I can think of, and I still can’t reach success. I’ve used the “Try It” section of the LIFX API docs successfully, but I can’t seem to translate that into working webhooks code.

Thanks, in advance, for any helpful direction.

Just a thought, persist you are sending a string but it is a Boolean as well as power, cycle is a double not a string.

Thanks for the suggestion. Gave it a try but it didn’t improve anything. For completion’s sake, the body read;

-H "Authorization: Bearer MY-TOKEN" -d '{"color" : "orange", "from_color" : "blue", "cycles" : 3, "persist" : false, "power_on" : true}'

I tried it with and without spaces between the colons. Also tried with cycles represented as 3.0.

Either your API Token is wrong or you need to use a %20 between Master and Bedroom: group:Master%20Bedroom. I had that issue before where I needed to URL encode the selector, but that was only with hyphens.

What’s the response you’re getting back from LIFX?

This is what worked for me in Postman, a chrome extension app.

POST /v1/lights/group:Living Room/effects/pulse HTTP/1.1
Authorization: Bearer MY_TOKEN
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: fe60670b-8dbb-302d-895d-40f46ee3fbd1

	"color": "orange",
	"from_color": "blue",
	"cycles": "3",
	"persist": "false",
	"power_on": "true"

This is the response I got back:

    "results": [
            "id": "d073d522ef06",
            "status": "ok",
            "label": "Living Room Lamp"
            "id": "d073d52346e8",
            "status": "ok",
            "label": "Living Room Right"
            "id": "d073d52390ab",
            "status": "ok",
            "label": "Living Room Left"

It was pretty wild seeing them pulse like that then go right back to their original color. Thanks for the tip! I never knew I could do effects like this with the HTTP API.

I just double checked my token – it is correct. I used that same token in the API pages with success too.

I was wondering if I had something wrong with that group name so I changed it to “all” after I made my last post… so it’s definitely not a space encoding issue, but I’m still stumped as to what I’m doing wrong.

I’m not sure how to tell what the LIFX response is through IFTTT and Webhooks. When I look at the IFTTT activity page, all I see is useless location data from where the request was made.

I see, you’re trying to use IFTTT for this, but LIFX doesn’t have a pulse method in IFTTT.

With IFTTT’s webhooks, I don’t know how you get the headers in there. It only looks like it takes a URL, method, and body :/. Have you tried Stringify before? It might be able to help you out.

Thanks @Sawtaytoes… I did try Stringify (ESPN/IFTTT to Stringify) and was able to get a basic pulse, but couldn’t get all of the parameters to run like I was hoping (like cycles - Stringify only provides fields for two parameters, which I’m using for color and from_color, but at least I could do the bearer authentication).

So I’m holding out hope that maybe one day a LIFX dev will see this and write an official pulse applet for LIFX’s service on IFTTT.

I agree, the Pulse applet should be added to IFTTT especially if it’s unable to be done any other way.

Why not contact Stringify directly? I’m sure Kris or someone else over there would be more than happy to help you out especially if it’s not something you can solve on your own because of an app limitation.

@mchowaniec not sure if you already found a solution. In case not, here it is.

You need to add the following to your IFTTT webhook request:
Method: POST
Content type: "application/json"
Body: {“color”:“orange”, “from_color”:“blue”, “cycles”:“3”, “persist”:“false”, “power_on”:“true”}


1 Like