Json Data from IFTTT

variables
ifttt

#1

I am trying to design a piston that will use the data posted from IFTTT in the JSON data to populate a variable in WebCore. When you use the IFTTT Webooks service, you can add additional components to that message. For Example:


Please note, I know what URL I’m supposed to input into IFTTT. I removed it to hide my key.

What I don’t understand is how I parse that data out of the body of the JSON message after it is received by WebCore. I know how to react to the IFTTT message but not what needs to happen next. I could not find any example pistons that spell this out. Any help would be appreciated.


#2

You would use an argument ($args).

You can take a look at this piston for a usage example:

Note the Log info "{$args}" line. That should show you what arguments to use (but since you’re building it in IFTTT, you’d probably already know it). You’ll see something like this in your logs once you trigger the IFTTT recipe.

[param1:execute, param2::7ab95f651fd552539183f9887ebf87b5:, service:[email protected], remoteAddr:34.201.45.176]

That should get you on your way.


#3

Nope, sorry, I have no idea what you’re talking G about. This doesn’t have the trigger from IFTTT. How do I tell webcore how to pull the data out of the message from IFTTT and what variable it equals? This is totally not what I’m trying to do.
You’re counting values using a switch, which I also don’t understand. The info I’m trying to set into a variable is coming directly from IFTTT.
It also makes no sense that you’re having a speech alert while you’re away but hey, whatever works for you.


#4

What my piston does or does not do isn’t really the point here. It was just a way to demonstrate the use of arguments, which is how webcore pistons access the JSON data sent by IFTTT.

Here is what I’m sending from IFTTT:

image

Once IFTTT triggers the piston, you can see from the log entry that my JSON key value pair (sender:from address) was received by webcore.

[param1:execute, param2::7ab95f651fd552539183f9887ebf87b5:, service:[email protected], remoteAddr:34.201.45.176]

You can then pull that into whatever action/condition you want by using arguments ($args).

Clear as mud?

Also, you don’t have to use an IFTTT trigger to kick the piston off, you can just use the external URL, which is what I’m doing.

image


#5

I do have to do it from IFTTT because the trigger is an event starting in my office 365 calendar. What you’re still not showing me is what would go after the trigger from IFTTT. This is what I have so far.

You are skipping right from IFTTT to the comparison between the two arguments. What I want to know is how are you getting the info sent in the JSON message into the services variable. Is that any clearer?


#6

I’m using IFTTT to trigger mine as well. Your way is also fine. There’s more than one way to skin a cat. If you’re comfortable with the way that you’re doing it, stick to it.

You don’t have to run the Parse JSON data {Test} action. You can go straight to setting variables after the IFTTT trigger.

That’s assuming your IFTTT recipe is sending “Test” as a key in its payload.

image


#7

Hi! New to webCoRE. I started off with Stringify but it was a headache to keep them both in sync.

So now i am here!.

So from my understanding if you want to use JSON you should then use the link from the quick facts section instead of the link that is generated from using a trigger for IFTTT in webCoRE?

I opened the link under my quick facts and noticed that if i use IFTTT as a trigger i get this “{“result”:“OK”,“timestamp”:1526664881959}” information.

One thing that i don’t follow is IF you do decide to use an IFTTT trigger in the ‘compare to’ what are you suppose to compare against? just text? I don’t think you can pass values to this?

Another weird thing i don’t understand is in the body section in IFTTT should that match the ‘compare to’ text in the IFTTT trigger in webCoRE? this is how it makes sense in my head to have ifttt trigger this piston.


#8

Here’s an example… fingalert is what the piston is comparing to.

This is what it looks like on the IFTTT side…

In your piston, you can log to console or save to a variable $args.subject to save or print the content of subject.


#9

Ahhh ok that makes sense now. One other question. I currently have it working with a GET method type, and i have the body have the same text as the URL has, also i don’t have anything chosen in ‘content type’. In your example it would be ‘fingalert’. I’m thinking that if i wanted to follow your method then i would need to change the method type to GET and also change content type to JSON to actually get data.


#10

Are you trying to get data from IFTTT to webcore or from WebCore to IFTTT? What data are you trying to pass? What channel in IFTTT are you using?
Personally, by reading this, I don’t think you have it at all. The URL should not be in the body of the message. And you should not be using the GET type because that is used to retrieve data. If you are passing data from one to the other, I would use the POST type and then JSON. But if you give a little more info I could show you exactly how to set it up in IFTTT and webcore. Between this and a few other threads, I have it working very well at this point.


#11

Hi Ryan! Thanks for the offer to help.

Let me explain what i understand and what i have done as i have it working now, but i haven’t incorporated any JSON data. I was barely starting to do that.

Right now i am only wanting to grab data from IFTTT --> WebCoRE. Future i want to be able to go backwards and forwards to see how to do it and see what i can use that for.

I don’t have the URL in the body i was merely talking about the value in the ‘compare to’. That is the same see here.

You see i have a myQ garage that will send a notification to IFTTT when i close or open my garage. This is what i want to then pipe into webCore so that i can get notifications through there and maybe use it for other triggers etc.

The thing i don’t understand is if the ‘compare to’ field has to be the same as the text that is appended into the end of the URL. Below is my IFTTT setup. It work rigth now, but i don’t use the JSON data that it is suppose to pass on. I want to now use the “createdat” ingredient in my push notification in webCoRE / ST to give me the date and time that the garage actually closed.


#12

If you’re trying to integrate a MyQ garage door, check out this app. Makes things MUCH MUCH easier.

But in general, you have a few things wrong with your piston. First, you have the variable Timestamp_closed but then within the piston you are setting the variable “Timestamp” equal to the argumenty from IFTTT. Also, why are you coming to ST to issue the Push Notification? Why not do it directly from IFTTT? Or for that matter, directly from the My Q app on your phone. That would respond a LOT faster.

But ultimately, take a look at the MyQ Lite app. I think that is what is going to solve a lot of your issues.


#13

Hi @Ryan780, thanks! I do want to use that smartapp i just don’t have the multi purpose sensor from ST so i have not gone through and done this yet until i buy that.

Also you are right i could just use the MyQ app and get it from there, i was just trying to get it all funneled in from one app and also planned on using the trigger to then trigger a piston for instance or something like that.