Jump to content









Photo

Problem with sending data in payload with triggers to IFTTT

payload in trigger

  • Please log in to reply
5 replies to this topic

#1 iot.npp

iot.npp

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 14 January 2016 - 06:20 AM

Hi Team ,

 

 

   I am sending temperature sensor values using Arduino-Yun to carriot which works properly.Now what I want to do is push carriots data to IFTTT's Maker channel.I am able to create trigger & it successfully calls the Maker channels event.I have mentioned temperature value in payload field as per carriots tutorial guide "value1="%%%Temperature%%%" but somehow its not working.
Could you please help me out?

 

 

Thanks,

-Snehal



#2 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPip
  • 27 posts

Posted 14 January 2016 - 03:02 PM

Hi Snehal,
 
You need send the values to IFTTT Maker Channel doing a POST Request. In this link are explaining how: https://ifttt.com/maker.
You can create a trigger or a listener in Carriots that do the POST to IFTTT Maker Chanel with the value of the temperature.
 
I hope this help you.
 
Carriots Staff


#3 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPip
  • 27 posts

Posted 14 January 2016 - 03:11 PM

I leave an example of a listener to send the value to the maker channel,

 

IF EXPRESSION:

 

context.data.containsKey('temperature')

 

THEN EXPRESSION:

 

import com.carriots.sdk.utils.BasicHttp;
import groovy.json.JsonOutput;
 
def Http = new BasicHttp();
Http.url = "https://maker.ifttt.com/trigger/{event name}/with/key/{key makers channel}";
Http.verb ="POST";
 
def content = ["Content-Type": "application/json"];  
Http.headers = content;
def payload =  [ "value1" : context.data.temperature ];
 
Http.payload= JsonOutput.toJson(payload);
 
Http.send();
 
Carriots Staff


#4 snehal.jabade

snehal.jabade

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 08 February 2016 - 11:16 AM

Hi Team,

 

    I am creating trigger using API console successfully.I am sending data in payload as follows:

 

  {"url":"http://10.0.0.145/hello.php",
"verb":"POST",
"payload":"Light=%%%Light%%%"}

 

  What I accepting is it gets Light's value from data stream but it does not get actual value from data stram.I got the following response:

{ "code": "2001", "message": "Trigger created", "details": { "name": "PHPTrigger9", "description": "CarriotPHPTrigger with data", "max_retries": 2, "push_frequency": 1, "enabled": true, "id_service": "55e564a55c5d752a4e48d0fa", "external_configuration": { "url": "http://10.0.0.145/hello.php", "verb": "POST", "payload": "Light=%%%Light%%%" }, "id_developer": "PHPTrigger9@username", "created_at": 1454930057, "owner": "snehal.jabade", "_id": "56b878895c5d75ce5ff59559" } }


#5 bpereira.rojas

bpereira.rojas

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 03 August 2016 - 02:14 PM

And to send more than one data within a payload?...



#6 Rorence

Rorence

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 02 May 2017 - 07:58 AM

Thanks for your nice post to teach us more in this field. After reading on here, we can learn more in this topic. 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users