News for hackers. Stuff that matters.
Re:Show HN: tttfi – Middleware for IFTTT by rockostrich on Monday July 17, 2017 @05:07PM (#14792279)
I'm not sure middleware is the right term for a server that responds to webhooks.

Either way, I think this is a good introduction for someone who is looking to do very simple things with an IFTTT integration. I don't think a node.js server running a python script inside of a docker container is the best way to go about it. Anyone who is trying to learn how to write integrations to services (such as IFTTT) will get the wrong impression if they try to dissect this code.

Re:Show HN: tttfi – Middleware for IFTTT by ehsankia on Monday July 17, 2017 @08:23PM (#14793411)
Yeah. I made something similar with a raspberry pi I had around the house. Hosted a simple HTTP Server using 10 lines of Flask, and used IFTTT's Maker service to glue it all together.

There are many ways of getting this setup, whatever you're most comfortable with. The key here is that this Maker service exists that let's you do basic REST input/output

Re:Show HN: tttfi – Middleware for IFTTT by cel1ne on Tuesday July 18, 2017 @04:16AM (#14795046)
I used postgresql along with postgREST to get my smartphone talk via ifttt to my raspberrypi.

no code except the SQL-Schema and complete freedom in data and API design.

Re:Show HN: tttfi – Middleware for IFTTT by unixhero on Tuesday July 18, 2017 @07:26AM (#14795699)
Interesting!!
Re:Show HN: tttfi – Middleware for IFTTT by _Marak_ on Monday July 17, 2017 @05:23PM (#14792373)
If you are interested in doing this locally ( without IFTTT dependency ), I'd suggest checking out: https://github.com/stackvana/microcule
Re:Show HN: tttfi – Middleware for IFTTT by zrail on Monday July 17, 2017 @08:09PM (#14793365)
Zapier has this built in. Granted you can only really write scripts that run directly on their platform in JavaScript, but within that scope you can do basically anything you want.

You can also write your own private apps that execute on your own infrastructure in whatever language you want.

https://zapier.com/developer/documentation/v2/scripting/

Re:Show HN: tttfi – Middleware for IFTTT by OhSoHumble on Tuesday July 18, 2017 @04:49AM (#14795156)
There is this website, donorschoose.org, that allows you to donate to schools within the United States. Teachers are able to post projects that are open to funding - art supplies, music, books, etc - and their projects would be posted in a public space and open to funding from individuals or organizations.

Donors Choose also has an API that one can use to programmatically list projects. I paired that API with Zapier to notify me about projects that I cared about - namely, classrooms that were filled with lower income students who had trouble getting fed at home.

Now I get a notification whenever a new project is created that fits the profile of what I want to donate to. Doing the same with IFTTT, from what I can tell, is kind of impossible. I looked into writing a shim API that would enable that type of notification but I couldn't get keys for the IFTTT service.

I dunno. Zapier seemed to offer better functionality and I didn't even have to pay for it.

Re:Show HN: tttfi – Middleware for IFTTT by bryanh on Monday July 17, 2017 @10:33PM (#14793915)
Also Python -- both as triggers and actions. https://zapier.com/help/code/ https://zapier.com/help/code-python/
Re:Show HN: tttfi – Middleware for IFTTT by voltagex_ on Tuesday July 18, 2017 @02:48AM (#14794699)
Isn't Zapier a lot more expensive though?
Re:Show HN: tttfi – Middleware for IFTTT by zrail on Tuesday July 18, 2017 @08:50AM (#14796097)
Yes $20 per month is a lot more expensive than free, I suppose, but Zapier also has a limited free plan that would probably cover what OP is doing.
Re:Show HN: tttfi – Middleware for IFTTT by hengheng on Monday July 17, 2017 @05:00PM (#14792219)
Slightly OT: I signed up for the IFTTT newsletter a long time ago, in hopes to find out what people use the thing for. Turns out it's impossible to unsubscribe from that newsletter, which disqualified the whole service in my eyes.
Re:Show HN: tttfi – Middleware for IFTTT by trillic on Monday July 17, 2017 @05:05PM (#14792262)
Set up and IFTTT action to delete all emails from IFTTT
Re:Show HN: tttfi – Middleware for IFTTT by nothrabannosir on Monday July 17, 2017 @05:09PM (#14792288)
Mark them as spam. Train your provider's filters and let the problem solve itself. Get enough people on board and suddenly poof unsubscribe links will appear like magic!
Re:Show HN: tttfi – Middleware for IFTTT by swsieber on Monday July 17, 2017 @05:15PM (#14792320)
I endorse marking them as spam. If they don't let you unsubscribe, they are spam.
Re:Show HN: tttfi – Middleware for IFTTT by 33W on Monday July 17, 2017 @05:43PM (#14792522)
I use IFTTT for a few different things:

1. Logged to a google spreadsheet when I enter and leave a radius around my work. I have to log hours worked, so this gives me a starting point at the end of the week for when I was physically here.

2. I get a stock price emailed to me when the market closes. I own a few shares of a single company (lowers my auto insurance premium, and keeps my engaged in the market), so this helps me see day-to-day changes.

3. I get the weather pushed to my phone at 6am every morning, so it is there on my lock screen as I'm getting up.

4. I get an email every time someone goes into space. SPACE.

Re:Show HN: tttfi – Middleware for IFTTT by koolba on Monday July 17, 2017 @06:22PM (#14792732)
How does owning stock lower your auto insurance premiums?
Re:Show HN: tttfi – Middleware for IFTTT by akovaski on Monday July 17, 2017 @08:14PM (#14793384)
Not OP, but from googling around, it seems like that there are many stocks which offer stockholder discounts/rewards. For example, it appears that stockholders of BRK.B can get an 8% discount on Geico insurance.
Re:Show HN: tttfi – Middleware for IFTTT by 33W on Tuesday July 18, 2017 @10:43AM (#14796890)
Not owning stock specifically, but having an open brokerage account added to a multi-product discount.
Re:Show HN: tttfi – Middleware for IFTTT by Larrikin on Monday July 17, 2017 @10:16PM (#14793866)
I've noticed a very scummy technique in newsletters that I've been signed up for lately. They are making the messages a certain length so that all the information they want to present is there but the legally required unsubscribe link is hidden behind gmail's automatic truncation of long emails. This makes it so you have to click the view whole email button.
Re:Show HN: tttfi – Middleware for IFTTT by angerbot on Monday July 17, 2017 @05:44PM (#14792528)
If you're in Canada report them for violating CASL - it's a cool $10k fine per infraction, I'd imagine they'll add an unsubscribe link right quick.
Re:Show HN: tttfi – Middleware for IFTTT by ahazred8ta on Monday July 17, 2017 @06:34PM (#14792808)
hengheng, "To disable these emails, sign in to manage your settings or unsubscribe." https://ifttt.com/passwords/forgot

Does this link work for you?

https://ifttt.com/emails/unsubscribe?email_type=newsletter (visiting this link unsubscribes you if you're signed in)

Re:Show HN: tttfi – Middleware for IFTTT by corobo on Tuesday July 18, 2017 @03:38AM (#14794905)
> sign in to manage your settings or unsubscribe

That is not an unsubscribe link. Unsub links remove you from the list without having to log in

One of my more annoying frequent inbox flyers is a newsletter from some website or other that says I need to log in to change my preferences.. only my account there must have been purged as they have no record of my email address (the exact email being sent the newsletters)

Sites - just provide easy one-click unsubscribe links, chances are it'll improve your open/click rate as you're letting people who aren't interested sift themselves out.

Re:Show HN: tttfi – Middleware for IFTTT by hengheng on Tuesday July 18, 2017 @07:25PM (#14800887)
Perhaps that link did something for me, I have no idea. Why do you not have an unsubscribe link in your e-mails? Where I live, this is a legal requirement.
Re:Show HN: tttfi – Middleware for IFTTT by nerdponx on Monday July 17, 2017 @05:38PM (#14792485)
I'm pretty sure that's illegal in the USA.
Re:Show HN: tttfi – Middleware for IFTTT by OJFord on Monday July 17, 2017 @10:30PM (#14793903)
Also in the UK, but the last list I tried to request an unsubscription from (and with references suggest they include an 'unsubscribe' link) bounced the email. What really are you going to do...
Re:Show HN: tttfi – Middleware for IFTTT by jld on Monday July 17, 2017 @05:13PM (#14792305)
I wish IFTTT were faster. Many recipes only seem to be run a few times a day.

I've been concocting a bunch of things in AWS Lamdba lately which should be in a service like IFTTT.

Re:Show HN: tttfi – Middleware for IFTTT by gs1 on Monday July 17, 2017 @05:24PM (#14792386)
The infrequent pollings were an irritating aspect of IFTTT. Also, I wished for more advanced functionality similar to what Yahoo Pipes provided.
Re:Show HN: tttfi – Middleware for IFTTT by rchakra3 on Monday July 17, 2017 @06:34PM (#14792809)
I've started using stringify with IFTTT to get a lot of my home automation working now.

I'd use stringify exclusively but IFTTT has a lot more integrations, so I end up using IFTTT as both a trigger and action in stringify. Ugly, but it works.

Re:Show HN: tttfi – Middleware for IFTTT by mod on Monday July 17, 2017 @05:42PM (#14792519)
Yahoo pipes is gone, right? So for us who didn't experience it, what kind of advanced functionality did it offer that is missing in ifttt?
Re:Show HN: tttfi – Middleware for IFTTT by ahazred8ta on Monday July 17, 2017 @06:50PM (#14792926)
Briefly, Pipes worked with feeds and data streams. IFTTT triggers on events.

https://google.com/search?q=ifttt+yahoo+pipes

https://www.import.io/post/5-yahoo-pipes-alternatives-that-a...

Re:Show HN: tttfi – Middleware for IFTTT by sdoering on Monday July 17, 2017 @05:00PM (#14792218)
Legacy python nowadays? I really cannot understand why one would use legacy with a new project.

Sorry but I could understand if you had to maintain a legacy code base.

Re:Show HN: tttfi – Middleware for IFTTT by luke3butler on Monday July 17, 2017 @05:08PM (#14792287)
The entire project is 89 lines of ES6 JS. Python 2 was just used for four lines of example middleware.

You can write middleware in anything that's executable via a terminal window.

Re:Show HN: tttfi – Middleware for IFTTT by oxguy3 on Monday July 17, 2017 @05:03PM (#14792253)
Python2 is still what comes installed as stock on many distros. I know Fedora/CentOS ship with it, in part because the package manager Yum/DNF is based in Python2.
Re:Show HN: tttfi – Middleware for IFTTT by toyg on Monday July 17, 2017 @07:05PM (#14793038)
That's not even true anymore. From https://fedoralovespython.org/ :

   On Fedora, Python comes pre-installed with first class support for 
   Python virtual environments. It is ready for use straight out of the 
   box. No guessing package names, no installation, just dive in and go. 
   Look:
   [fedora]$ python3 -m venv env
   [fedora]$ . env/bin/activate
   (env) [fedora]$ python ...
Note the python3 ...

EDIT: wow, 4 downvotes for stating a fact that Fedora developers themselves are shouting from rooftoops. The Python3 hate is strong today.

Re:Show HN: tttfi – Middleware for IFTTT by OJFord on Monday July 17, 2017 @10:26PM (#14793887)
But what's the output of

    python --version
(note not python3)
Re:Show HN: tttfi – Middleware for IFTTT by maweki on Tuesday July 18, 2017 @02:42AM (#14794673)
PEP 394 says that python should point to python2 for the time being.

https://www.python.org/dev/peps/pep-0394/

Re:Show HN: tttfi – Middleware for IFTTT by toyg on Tuesday July 18, 2017 @03:20AM (#14794829)
Yup, and it will be reviewed and likely changed at some point:

   This recommendation will be periodically reviewed over 
   the next few years, and updated when the core development
   team judges it appropriate. 
So it's likely that at some point between here and 2020, or in 2020 at worst, the recommendation will change.

IMHO Python 3 has now reached a level of maturity and backward-compatibility where it can safely take over as system python. It's now shipped by Fedora, which means the next RHEL will also ship it. Updating old scripts should mostly be a matter of grepping and shebanging from python to python2, and there is now no point in procrastinating further with this move.

Re:Show HN: tttfi – Middleware for IFTTT by Freak_NL on Tuesday July 18, 2017 @02:44AM (#14794679)
Any proper Python script starts with a shebang:

    #!/usr/bin/env python3
This works on all modern Linux distributions today.
Re:Show HN: tttfi – Middleware for IFTTT by OJFord on Saturday July 22, 2017 @06:36PM (#14829814)
Yes, and if you write it like that, the output of `python --version` has direct consequences for the remainder of the script.
Re:Show HN: tttfi – Middleware for IFTTT by twblalock on Monday July 17, 2017 @05:18PM (#14792342)
The majority of the Python programmers I know still use Python 2 for new projects.
Re:Show HN: tttfi – Middleware for IFTTT by mod on Monday July 17, 2017 @05:41PM (#14792502)
Out of curiosity, how recently have you touched on that?

I was one of them until the last couple of months. I think moving to 3 now makes sense, and it's pain-free in my experience.

In 2016 I hadn't made the move yet. And as recently as a couple of months ago, sometimes py2 was still the choice (for instance, Amazon Lambda didn't support 3 yet).

Re:Show HN: tttfi – Middleware for IFTTT by foxylad on Tuesday July 18, 2017 @12:17AM (#14794234)
And Google Appengine is stuck on Python 2.
Re:Show HN: tttfi – Middleware for IFTTT by tuxxy on Monday July 17, 2017 @06:47PM (#14792902)
I don't believe this for a minute.

Sure, lots of Enterprise apps use Python 2 because that was what they could build with.

I'm a Python developer and I don't know anyone who doesn't use Python 3 by default.

I understand this is purely anecdotal, but it seems outlandish to say that Python devs mostly use Python 2.

Re:Show HN: tttfi – Middleware for IFTTT by fermuch on Monday July 17, 2017 @07:34PM (#14793212)
This is still anecdotical, but most python developers I know would chose py2 if given the choice. It's what they know, and they don't want to change semantics even if it's just changing how you write prints.
Re:Show HN: tttfi – Middleware for IFTTT by anilakar on Tuesday July 18, 2017 @03:49AM (#14794941)
Counter-anecdote: Not a single developer I know wants to touch Python 2 after trying to get Django to work reliably with Unicode.

Then again, if your language is completely representable with US-ASCII, you might not have experienced the pain caused by having to unit test pretty much all string operations in your code.

Re:Show HN: tttfi – Middleware for IFTTT by jsnathan on Tuesday July 18, 2017 @04:24AM (#14795078)
I like to trot out this link whenever this comes up [1].

[1]: https://semaphoreci.com/blog/2016/11/11/python-versions-used...

Re:Show HN: tttfi – Middleware for IFTTT by twblalock on Monday July 17, 2017 @11:43PM (#14794141)
> I understand this is purely anecdotal, but it seems outlandish to say that Python devs mostly use Python 2.

Then I guess it's a good thing I didn't say that. I said the majority of the ones I know use it.

Re:Show HN: tttfi – Middleware for IFTTT by serf on Monday July 17, 2017 @07:15PM (#14793091)
the only devs I know that use python2 are ones that stuck having to do so because no one has put the legwork in to port a library over to py3.
Re:Show HN: tttfi – Middleware for IFTTT by kamikat on Monday July 17, 2017 @09:06PM (#14793642)
I've re-written sample script in pure shell code :P

The idea is that I'd like to write little to make little things work with IFTTT. Py2 is just enough to do a lot while keeping things casual and of fun. Py3 is too serious to me and shell script just awful...

Happy hacking.

Re:Show HN: tttfi – Middleware for IFTTT by dmerrick on Monday July 17, 2017 @04:59PM (#14792210)
Wonderful idea. So wonderful, in fact, it makes one wonder what is taking IFTTT so long to offer up similar functionality.
Re:Show HN: tttfi – Middleware for IFTTT by eli on Monday July 17, 2017 @07:23PM (#14793148)
I don't think it's compatible with their business model to allow arbitrary integrations.
Re:Show HN: tttfi – Middleware for IFTTT by yjftsjthsd-h on Monday July 17, 2017 @10:32PM (#14793909)
Wait, I thought they had the maker channel specifically for creating arbitrary custom integrations?