Interface with the If This Then That (IFTTT). This example uses both POST and GET to interface with IFTTT. Up to 3 values can be sent along with the trigger event name.

Dependencies:   EthernetInterface IFTTT mbed-rtos mbed

What Is This

This is an example program for using the If This Then That (IFTTT) Maker Channel Service. For more information please see https:developer.mbed.org/components/If-This-Then-That-IFTTT/

How Does It Work

There are two ways to use the channel, you can send either POST or GET requests with up to 3 values per request. Note that the values must have the names "value1", "value2", and "value3", if you call them anything else they will be ignored.

IFTTT

You will need an IFTTT account and enable the maker channel. Once you have registered for this channel you will get a channel key and will be able to register event trigger names.

GET

The GET requests pass the variables through query parameters.

?value1=some&value2=random&vlaue3=values

POST

The POST request will pass the variables through a JSON formatted form.

How To Use It

Register for an IFTTT Account, add the maker channel, add a trigger to the maker channel. Fill in the event name and the key fields in your code with the keys from the ifttt account. Create a recipe that uses the events as triggers, compile the code, load and run it. Now you should be able to trigger a recipe from your mbed device!!!

This is an example of how to use the If This Then That Maker Channel service. There are two ways to access the service, one via a GET request and the other via a POST request. You can send up to 3 variables with each interaction. These variables must be names variable1, variable2, variable 3. The GET requests will send the varaibles in the query string, so it looks like "?variable1=somevalue&variable2=somevalue&variable3=somevalue" . The POST request will send the values in a JSON formatted form request.

// Initialize ifttt object, add up to 3 optional values, trigger event.
IFTTT ifttt("YourEventName","ChangeToYourSecretKey", &socket); // EventName, Secret Key, socket to use
ifttt.addIngredients("this is awesome","test-ing","data!!!");     // 3 optional Values to send along with trigger.
ifttt.trigger();

You can find the IFTTT recipe here.

/media/uploads/mbedAustin/ifttthelloworldrecipe.png