Jump to content


Send multiples values in trigger

  • Please log in to reply
1 reply to this topic

#1 bpereira.rojas



  • Members
  • Pip
  • 2 posts

Posted 01 August 2016 - 09:05 PM

Someone could help me, I'm trying to send more than one item from a trigger and not like composing my payload.
I have 3 values and need to send them to my website from a trigger ... any suggestions.


#2 RTCeables



  • Members
  • Pip
  • 5 posts

Posted 03 October 2016 - 04:01 PM

I noticed no one has replied to this query. Given that this is now 2 months old, I am not sure if this is still of use.


So for the benefit of others...


My suggestion is for you to look at some of the tutorials on carriots website. Here is one example: https://www.carriots...hers_APIs/ifttt


Within this page, you will find the following code:


import com.carriots.sdk.utils.BasicHttp;
import groovy.json.JsonOutput;
import groovy.json.JsonSlurper;

def Http = new BasicHttp();
Http.url = "https://maker.ifttt.com/trigger/Tutorial/with/key/{MAKER CHANNEL KEY}";
Http.verb ="POST";

def content = ["Content-Type": "application/json"];  
Http.headers = content;
def payload =  [ "value1" : context.data.temperature, "value2" : context.data.humidity ];

Http.payload= JsonOutput.toJson(payload);

You will change Http.url to match your website.

The above example uses POST so on your website script you will need to handle this.


See "payload" this has two values. You will simply add a third.

Then next is to convert to Json using "JsonOutput.toJson(payload)"

Then you can send.


Then in your website script you will need to decode the json.


Hope that helps.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users