How-to: Connect Jibo SDK to IFTTT Maker recipe (in 10 minutes)


#1

Objective

This a quick walkthrough of how to connect the Jibo SDK to your own custom IFTTT Maker recipe. This can allow you to have Jibo send you a notification or email, control your Nest or other smart thermostat, control a smart appliance, or whatever else you have connected in your IFTTT account.

Prerequisites

You’ll need a working version of the Jibo SDK installed on your computer as well as an active IFTTT account.

Steps

  1. If you haven’t already, connect to the Maker channel in your IFTTT. To do this, login to IFTTT, click Channels, click Maker from the list of available channels, then click Connect. Copy the key shown…you’ll need this later.

  2. Create a new recipe in IFTTT. In IFTTT, click My Recipes, then click the Create a Recipe button.

  3. Set the “this” (Trigger Channel) part to Maker. For the trigger, choose “Receive a web request” and give an event name like “jibo_send_email” based on what you want this recipe to do when it receives a request from Jibo.

  4. Set the “that” (Action Channel) part to the action you would like IFTTT to take when it receives a request from Jibo. For this example, IFTTT will send an email. For the action, choose what is appropriate for your situation (e.g. Send me an email).

  5. Set the Action Fields according to the data you’ll be passing from Jibo. For this example, we’ll be passing a subject and body for the email using “Value1” and “Value2”, respectively, when Jibo sends the event to the IFTTT Maker recipe. When complete, click the Create Action button to save your new IFTTT Maker recipe.

  6. Create a new project in your Jibo SDK. Don’t forget to npm install it if needed after creation. You can also use an existing project if you wish.

  7. Add the npm module iftttmaker to your project. To do this, just navigate your console to your projects folder and npm install iftttmaker.

  8. Create a new ExecuteScript behavior for your IFTTT Maker recipe call. You can also use an ExecuteScriptAsync behavior if you want Jibo to pause until the IFTTT call succeeds (or fails). Copy/paste the appropriate code for your choice below:

ExecuteScript

() => {
  var apiKey = '[API_KEY]';
  var IFTTTMaker = require('iftttmaker')(apiKey);
  var action = '[EVENT_NAME]';
  // Promise
  IFTTTMaker.send(action, '[EMAIL_SUBJ]', '[EMAIL_BODY]').then(function () {
    console.log('Request was sent');
  }).catch(function (error) {
    console.log('The request could not be sent:', error);
  });
}

ExecuteScriptAsync

(succeed, fail) => {
  var apiKey = '[API_KEY]';
  var IFTTTMaker = require('iftttmaker')(apiKey);
  var action = '[EVENT_NAME]';
  // Callback
  IFTTTMaker.send(action, '[EMAIL_SUBJ]', '[EMAIL_BODY]', function (error) {
    if (error) {
      console.log('The email could not be sent:', error);
      fail();
    } else {
      console.log('Email was sent');
      succeed();
    }
  });
}
  1. Change the placeholders to match your info: Change the [API_KEY] to the IFTTT Maker API key you recorded in Step 1. Change the [EVENT_NAME] to the event name you chose in Step 3. If you’re following the email example, change the [EMAIL_SUBJ] and [EMAIL_BODY] to whatever you like. Otherwise, you can use those two slots to pass any info you need to your IFTTT Maker recipe action using “Value1” and “Value2”. If you don’t use those values, you can safely remove those arguments from the send() function.

  2. Run the skill to see your new Jibo-connected IFTTT Maker recipe in action!


Jibo will speak IFTTT?
Music Playlist AI for jibo?
Make Jibo post status message on Facebook with IFTTT
#2

A new dimension just opened up … AWESOME !! :joy:


#3

While it’s cool that this works, it’s not quite the full IFTTT integration we need for Jibo.

This setup uses the Maker connection IFTTT provides which is intended for smaller DIY projects and, as such, requires the Jibo SDK and a Maker API key…not really something your average user could incorporate on their own.

If the Jibo team would register Jibo as an IFTTT channel, it would be much more powerful and easy to use, as well as serving as a new marketing tool for all existing IFTTT users.


#4

Thanks Michael for writing this up. I tried it out and it works great!


#5

I wonder if someone could help me out. I’m attempting to learn JavaScript so I can get involved in here. Right now I know next to nothing.

So I’ve got a very basic understanding of the way rules and actions interact and I have a working maker channel. I also tested the trigger via the IFTTTT maker channel so I know it should work.
But for the life of me I cant get this ifttt process to work. If someone could look at what I have and point out my error I would truly appreciate it.

Thank you!

Currently what happens is that I say “Hey Jibo”, get his attention, say “test” and Jibo stops listening and goes back to idle immediately.


#6

Hi @codemonkey2k5,

It looks like an easy fix. You’re missing a “|” separator in your main.rule file between the “spin around” and “test” rules. Here’s what you should have:

( (spin around){action='Spin'} ) |
( (test){action='kitchenlight'} )

The “|” separator is added just after the close of the Spin action. You can check to see if the word “test” triggers your rule/action by simply typing test in the “Test main.rule” area on the right of the rule editor…if it doesn’t, you have an error in your rule file somewhere.


#7

OK well that was simple enough. I do still have one issue.
When I created the maker trigger it opened a page where you could test it. I did and it worked.
But it is not working from the simulator. I suspect it is because I messed up the code when I removed the email related fields from your example. I put a text to speech action in the sequence so I know the sequence is running. But there is no way (that I know of) to troubleshoot if the command is actually being sent to IFTTT. I feel like i’m really close though.

Thank you for your help!


#8

Just wanted to add this if it helps clarify at all. The following works just fine.


#9

Could you post the code from your IFTTT call in the skill itself? It would me track down where your issue is coming from.


#10

Unless I am not understanding you, it should be in screenshot above 3rd one down. If you are talking about something else then sorry, you’ll need to help me find what your looking for.


#11

Sorry about that…forgot you posted it in that 3rd screenshot. What outputs on your console (from line 7 and 9 in the ExecuteScript code behavior)…“Request was sent” or the error?


#12

Nothing at all. If I put the brackets back around the key, I see the error, but remove them and I get nothing.


#13

Found what was missing…in your 3rd screenshot, the ExecuteScript behavior is missing the action parameter in the IFTTTMaker.send() function. You must have removed that when you removed the optional parameters:

IFTTTMaker.send(action, function () {

#14

I knew it was going to be something stupid like that! Thank you!!!
Now i can go about setting up all of my insteon lighting. :slight_smile:

I’m hoping someone creates an insteon hub skill though as it would react much quicker than IFTTT.


#15

Not a problem…glad you got it working! :slight_smile: Connecting to Insteon sounds fun…can’t wait to see Jibo controlling your home. Imagine the power Jibo would have in home security mode. Very cool!


#16

@codemonkey2k5 I’m so glad to see your got your first skill up and running! Especially with @michael’s help using IFTTT. This is really really cool.

Using @michael’s steps I created a blog post : https://developers.jibo.com/blog/jibo-ifttt-in-10-minutes#

My hope here is that more people outside our community will see this and also start building on Jibo and expand the capabilities of Jibo! We love seeing what the community builds! Thank you everyone for building, sharing and educating!


#17

As a reminder why IFTTT is getting to be a more important tool each day, Google just announced that their Google Assistant has 59 new recipes available there. If Jibo had their own IFTTT Channel, it could connect directly (and talk to) the Google Assistant. Jibo’s potential always grows exponentially when he meets a smart friend. :jibo:


#18

PLEASE!!?? That would be beyond awesome!


#19

Here is a video of a demo using IFTTT to control a littleBits servo bit through the Jibo SDK:


#20

Wished they would have danced together longer :slight_smile::jibo::jibo: Thanks for the shoutout…IFTTT really opens up a lot for Jibo. Hopefully they’ll get their own channel one of these days and open it up to more than just developers.