Integrate pebble with IFTTT once again!

If This Then That (IFTTT) is a popular service which lets you hook apps and services together. Before Pebble collapsed there was a pebble component which let you push pins to timeline. Now that rebble have brought timeline back, I’ve created a service which will once again allow you to create timeline pins via IFTTT.

Note: Version 2 of PinProxy has been released, so the configuration tool now has more options. This tutorial still works though! Once you’re done, see here for what’s new in release 2.

IFTTT has support for ‘webhooks’, which allow you to configure arbitrary web requests. It’s here I hoped I could just point it at rebble web services (rws) and be done with it, but it’s not that quite simple.


When you create a new timeline pin, you must create a unique ID for it too, and this ID needs to go in both the URL you call, and the JSON data you pass. Currently, there is no way to generate and subsequently use this ID in an IFTTT webhook. That’s where the pinproxy services comes in. Pinproxy accepts an HTTP POST request with pin data but no ID, and creates an ID for it. It also handles setting the time for the pin, either setting it to appear immediately on the watch, or with a 30 or 60 minute delay.

Setup IFTTT with RWS

In this example we’re going to create an IFTTT integration which pushes a pin every time there is a new ‘best’ article on hacker news.

To start, head over to https://ifttt.com and create an account or login

Next, create a new applet, and select your ‘if this’. For this tutorial I’ll use the ‘new best hacker news article’

Once that’s done, we need to select our ‘then that’ – For this we need to select the webhook option

here you’ll see a few options:

URLThe url to call
MethodThe HTTP Method
Content-TypeThe type of message
BodyThe body of the request


Before we worry about any of those, we need to look at the ingredients – these are snippets of info we can insert that come from our ‘if this’ app. Press ‘Add Ingredient’ to see them, for hacker news we get:

So we can use things like the Title of the new best post in our pin. I’m going to create a pin with the title of the HN post as the title of the pin, and the pin subtitle as ‘via Hacker News’

Now, the good news is that you don’t need to worry about any of the webhook settings – there’s an app for that. Open the Pebble Pin Generator in a new tab.

The first thing you’ll need is a timeline token, if you don’t have a timeline token see below, if you do, skip straight to ‘create your pin template’ below.

Getting a timeline token

A timeline token is an authorization key that rebble issue you which authenticates calls to make new tokens. If you don’t have one, download Generate Token, (rebble appstore link) which is an app that generates a timeline token.

Once Generate Token is installed, you should open the app on your watch and press select, this will generate a token. Then, go into the pebble app on your phone, find Generate Token, and open settings. This will display your token on your phone and you can copy it to use with ifttt.

To check that it’s copied correctly, submit a pin using the Pebble Pin Tester App. Wait for your timeline to sync, and you should see the test pin.

Create your pin template

Okay, now you should have a timeline token, so paste that into the first field in the generate pin app.

Next, fill out the other three text fields. It’s here where you can use the app ingredients. If you click them in ifttt, you’ll see they are represented by strings encased in curly braces, so for the hacker news title, that’s:

{{Title}}


Which is what I want the title of the of the pin to be, so I’ll put that in the ‘pin title’ field. Once you’ve filled out all three fields, you should have the following (where XXXX-XXX… is your timeline pin):

I left the body blank for this example

The next step is to select the pin delay. No matter what you select, the pin will be sent to rebble immediately. However, because your pebble only syncs with rebble every 30 minutes, if we create a pin just after your pebble sync, you won’t receive it for another 28 minutes, and it will now be in your timeline past and won’t appear in timeline peek. Therefore it’s suggested to set the delay to 30 minutes to guarantee that the pin will be in your timeline future when your watch receives it. You can also optionally set it to be 1 hour ahead of the point at which it’s created.

If you are not subscribed to rebble, your pebble only syncs once every 3 hours, so the pin will possibly be in the past by the time your watch receives it.

Finally, select the pin icon. The dropdown lists all the default available icons.

Once you’re done, press ‘Generate JSON’ and a modal will appear with all the fields you need for the IFTTT webhook – magic! It will look something like this

Copy each field over to IFTTT, so for our example app, the IFTTT config will look like this

And that’s it! Create your action and you’re done. If you’re using any non-standard characters, you may want to check the timeline pin will be created by using the Timeline Tester, because rws/pebble doesn’t support the full UTF8 charset.

Play Nicely

Finally, I want to point out that with IFTTT, there is the potential for abuse. Please don’t create rules likely to trigger hundreds of times an hour. The Pin Proxy I’m running is fairly lightweight, and should handle a fair amount of load, but I make no promises about it’s uptime. I also reserve the right to block users or discontinue the service if it starts costing me money, though I doubt it’ll come to this. If you want to run it yourself, or contribute to the code, the source code is on Github. If you’re self-hosting, Timeline Bounce is a better option – this is a server designed to accept generic web requests, pick apart the info, and create timeline pins. Currently it supports basic pins (just like Timeline Tester), but also supports Monzo Webhooks, to put your debit card transactions onto timeline. In the future it’ll be updated to handle more formats, but it will remain a self-hosted only system.

Questions on a postcard

If you have any questions, find me on the rebble discord – @Will0

Update

This article was updated on 23/10/19 with the following updates:

  • Added link to Generate Token, now on the rebble appstore!

One thought on “Integrate pebble with IFTTT once again!”

  1. This is so cool. I didn’t even know that one can put pins to Timeline with web.
    I’m so happy that I’ve stumbled upon your website (webapps) – finally, after 5 days of owning a PTS ^^.

    Can you confirm, that it’s entirely Rebble’s problem, that it crashes upon any non-latin char?

    Thanks for your great job.
    I’m gaining traction in the pebble dev (:

Leave a Reply

Your email address will not be published. Required fields are marked *