Readit News logoReadit News
Posted by u/beatthatflight 6 years ago
Ask HN: What automation tools have you used to replace mundane activities?
For my travel site side hustle (beatthatflight.com.au/), I find and publish cheap flights for Australians. Sounds simple, but even if say, someone gave me the flights each day, there's posting the, sometimes to deals sites, as well as then editing it and posting it on my site, and out to social media, and then to specific mailing lists on mailchimp, depending on the source city of the deal, or type of post.

A LOT of that becomes tedious. Mailchimp can auto post to FB/twitter/instagram etc, but even converting the blog post into mailchimp emails gets tiring, as you need to choose a feature photo, the specific mailing list etc.

I'm a selenium guy, so have built some scripts to minimise some of it, but the rush each time of finding a deal still pains me when I think of the tedium ahead of publishing it.

Ideally, my goal would be to submit [to][from][when] to a script and the whole process would be automatic. I can see that selenium could do it, but my goodness, it'd be slow and potentially flaky all via the web UI for those sites.

I'd love suggestions, examples of automation you've done, and tools used?

iKlsR · 6 years ago
I have a slack workspace that has several bots, some listen for specific keywords and or phrases around the web and post to the relevant channels. Other bots remind me if I'm slacking off (maybe stayed a little too long on youtube), remind me of appointments, to drink water, if a stock price falls and some more. Also have filtered rss feeds for business and finance news etc. All of these bots also have custom identities that make it much more engaging like Axelrod is my bot for finance related news.

Others tell me if my server is getting swamped, forward important emails like renewing a cert, a deploy failed, bug in prod or something else that requires often immediate attention. Chat widgets from sites in production also go directly to Slack so I can reply quickly if needed. (Gmail, Sentry, Freshchat, Ploi etc, integrate them all and filter out what's critical).

Everything generally operates on a 15 min interval or so it's not noisy and I've pretty much tuned it to only receiving specific stuff I want to see. Having a central assistant like hub to go to is very useful and time saving.

bcantoni · 6 years ago
+1 for having a personal Slack workspace - I think this is an under-appreciated way to host side projects and learn how to develop with Slack. There are so many services which already include Slack integration, you can wire everything up into your personal notification space.
kryptn · 6 years ago
Oh cool, I didn't know if others were doing this. I've recently just started going down this path with some zero effort IFTTT triggers but I'm not happy with how infrequent they seem to trigger. My next step is to build my own set of listeners/scrapers.
bluehatbrit · 6 years ago
I posted the same thing on a similar thread yesterday but if you're looking to build some scrapers and listeners and make it easy for yourself I'd highly recommend Huginn (https://github.com/huginn/huginn). I set it up a few months back and I've been using it to scrape all sorts of info and alert me on things. IE:

* A change in GBP -> NOK exchange rate, to indicate if it's a good time to buy ready for my next trip to Norway.

* Alerts on flight prices to help me purchase flights when they're at their cheapest.

* Daily digest email with content I'm interested in from HN and some web comics.

* A summary of new content coming into my RSS reader.

It works really well for this sort of stuff and I found it fairly easy to get up and running.

iKlsR · 6 years ago
I found https://www.scrapingbee.com/ the other day. Checkout their blog as well, filled with useful stuff.
alexsexotic · 6 years ago
How does you not know if your slacking too long on YouTube? Do you use some chrome extension ?
muzani · 6 years ago
Did you build these bots or got them from somewhere?
iKlsR · 6 years ago
Some are are custom built from apis but I daresay you can find just about anything to hit a webhook or integrate into slack or elsewhere nowadays. Some examples are https://littlebirdie.io/ I use to filter hackernews, Zapier for RSS & filtering feeds, google calendar etc, nothing complicated, just know what you need from a specific service then figure out a way to get it to yourself in a recurring distraction free manner be it an existing addon or something you can roll yourself.
beamatronic · 6 years ago
What does this cost?
iKlsR · 6 years ago
Costs me nothing. Some channels eventually reach their lifetime usefulness like a topic I was interested in and amassed some 500+ mentions of it on twitter, business news from 8 months ago about someone getting acquired etc. I can export the messages and delete the channel to avoid history archival. Only real cost would be the one or two times a year maintenance and improving bits and pieces every now and then.

Deleted Comment

akulbe · 6 years ago
would love to talk to you more about how you set this up
iKlsR · 6 years ago
You can see the discussions under my main comment. Pretty much just make a slack workspace and start finding integrations for services you use. Zapier for one makes it super easy to filter out what can get to you from these but I'm seeing good things about https://github.com/huginn/huginn now.
buzzy_hacker · 6 years ago
I use YNAB (https://youneedabudget.com/), which requires inputting every one of your transactions by hand or importing them from your bank. The downside of the import is it takes a few days for the transaction to show up and you need to give YNAB your bank username/password, which I'm not comfortable with.

I wrote this https://github.com/buzzlawless/ynab-live-import to import credit card transactions instantly with no need of giving up my bank credentials.

The whole stack runs on Amazon Web Services. Simple Email Service receives a notification email from the bank that I've made a purchase, saves it to S3, and triggers a particular lambda function tailored to whichever bank the notification came from. The lambda function retrieves the email from S3, parses it for transaction data (account, payee, amount, date), and writes that data to a DynamoDB table. The table has a stream enabled, which triggers another lambda function when the table is updated. The function reads the transaction data from the stream and posts the transaction to YNAB using their API.

I've mentioned this on HN once or twice before and got some positive interest with people even submitting pull requests, which is awesome :) Going to find the time soon to review those and maybe add more features

RHSeeger · 6 years ago
> you need to give YNAB your bank username/password

I am constantly amazed by the people that are willing to do this for various value-added finance sites; people that I would normally consider sane. Unless your bank provides (and you used) a read-only account authentication, if something goes wrong and your money disappears from the bank, the bank is going to tell you to take a hike. I can't imagine taking this kind of risk with my money.

avree · 6 years ago
Sorry, but there’s no bank in the world that would tell you to simply “take a hike” if your password was breached and your money was stolen.
kazga · 6 years ago
For me, the username/password gives you read-only access and any kind of transaction requires 2FA.
bathtub365 · 6 years ago
That sounds a lot more complicated than just downloading bank statements and uploading them to YNAB and adds a lot more points of failure
simmanian · 6 years ago
Downloading and uploading bank statements is a manual process, unless you're willing to give the service your bank ID/PW, right? Seems to me if you set up your bank accounts to send you notification emails for any balance change, you can automatically reflect the balance without needing to deal with sensitive credentials.
ralmeida · 6 years ago
It does, but it also keeps YNAB more in sync with your bank account, since transactions will typically take a couple days to show up in the statement.
asdfman123 · 6 years ago
It probably started as a side project that would specifically let them experiment with those technologies.
tomaslaureano · 6 years ago
It's an amazing job what you have done here. I've been tinkering with exactly the same idea (and same implementation) but haven't had the time to go ahead. Your work will instantly jumpstart my own use case (VISA and Beancount) and I thank you for that. Kudos!
buzzy_hacker · 6 years ago
Thank you! Appreciate the kind words
aaron_m04 · 6 years ago
> you need to give YNAB your bank username/password

Why don't they have oauth for this?

lignux · 6 years ago
What do you do about cash transactions?
ralmeida · 6 years ago
Not OP, but there's not much to do about them - best way is to enter manually in the app at the time of purchase or write them down in a notebook and enter them in batch once in a couple days or per week.

If your cash spending is sufficiently small that you don't care much to tracking each cash transaction individually, you can just track money as a category instead of an account - just record an outflow transaction in your bank account when you withdraw.

wry_discontent · 6 years ago
I don't use ynab anymore, but when I did, I usually just didn't include cash in it. I almost never use cash, and so it made sense to just deduct the money when it became cash.
defterGoose · 6 years ago
I used to work at an architecture firm that specialized in design and manufacturing. One of our more popular products was facades made from aluminum panels with "graphic perforation", a pattern of holes made to form an image at a distance. As you can imagine, for larger projects the number of unique pieces to be cut was into the hundreds. This represented a lot of time for our CAM programmers because the (quite mature and industry standard) CAM software we used was incapable of determining the proper cut orientation without manual input. This meant clicking holes a bunch of times per panel to switch which side of the curve was cut. No Bueno.

One of our primary CAD suites was Rhino which is very nice and has a great python API. So I wrote a full-fledged 2.5D CAM processor for that. This allowed us to batch process hundreds of these parts with a single click.

lostintangent · 6 years ago
Playwright is a new alternative to Selenium, and besides being cross-browser, is focused on performance, developer ergonomics and reliability (death to flakiness!). Might be worth checking out? https://github.com/microsoft/playwright.

Disclaimer: I work with the Playwright team at Microsoft.

rumanator · 6 years ago
Hi thanks for mentioning your project. Are there any plans to use it for automated UI testing for desktop apps? Selenium supports it (more or less) with WinAppDriver, which is another project from Microsoft.

https://github.com/microsoft/WinAppDriver

lostintangent · 6 years ago
Desktop support is definitely on our long-term roadmap! We’re simply starting web, since it’s an area we think we can make big improvements to, before moving on to the broader developer landscape.

As we build out Playwright, we hope to learn a lot about how to make automation more reliable, ergonomic, and enjoyable for developers. Ideally, we could then apply those principles/learnings to desktop, mobile, etc. automation too. Stay tuned!

theshadowknows · 6 years ago
Might check out Sikuli
2rsf · 6 years ago
Looks promising ! although most of my problems (but not all) were related to environment and not Selenium itself.

> setTimeout-free automation

How ? you still need an upper limit for operations

lostintangent · 6 years ago
Each of the page operations (e.g. click) automatically wait for the specified element to become visible before being performed. That way, your automation code is declarative about what you want to do, and to what element(s), and you can allow the Playwright framework to handle any “waits” on your behalf (without having to rely on time as a pseudo event).

To make the act of selecting elements more resilient to change, Playwright also supports a collection of “selector engines” that allow you to choose the best strategy for selecting elements (via CSS selector, xpath, text content). Additionally, you can author entirely custom selector engines, and compose them together with the built-in types. This is still somewhat experimental, but we think this can enable another level of robustness to test automation: https://github.com/microsoft/playwright/blob/master/docs/sel....

Finally, in addition to waiting for element visibility, Playwright allows you to wait for specific page events to occur (e.g. network request work made). This enables your code to leverage deterministic “signals”, not timeouts (which are the source of a lot of flakiness!). Overall, we want it to be possible to author automation that is entirely event-driven, and includes zero arbitrary timeouts.

ta345345345 · 6 years ago
Keen to check it out; the flakiness of Webdriver/Selenium I often wonder is more pain than it brings. So many sites I see disabling tests based on it because they sometimes work/sometimes don't, the hours that get plowed into it.

Edit: Missed the Microsoft ref. Not so keen.

lostintangent · 6 years ago
Out of curiosity: why does the fact that Playwright is a Microsoft-sponsored OSS project discourage your interest?

The team is working very hard to be open/transparent/available (https://github.com/microsoft/playwright), and we’re very excited to build a better automation stack with the help of the community. I only ask since I’d love to hear any feedback for how we could improve the way we run/position the project. Thanks!

spikej · 6 years ago
Check out https://www.cypress.io Been super happy with it!
shostack · 6 years ago
Can you attach it to an existing browser window/session that is already open? Ie. I navigate and authenticate to a site, run code, and it continues from there with what's on screen?
lostintangent · 6 years ago
Playwright allows you to connect to existing browser instances, but it currently requires you to get the “debug URL” of the browser instance first: https://github.com/microsoft/playwright/blob/v0.11.1/docs/ap....

I’d love to hear a bit more about the scenario you have in mind, since that might help inform some improvements we can make. Thanks!

xzel · 6 years ago
Ah this looks great. I'm super happy I'm learning about this project. Do you guys have any plans of adding extensions ala puppeteer-extra?
lostintangent · 6 years ago
As part of our goal to enable better developer ergonomics, we’re very keen to explore “better”/higher-level APIs and additional extensibility points. For example, we allow you to define custom “selector engines” (https://github.com/microsoft/playwright/blob/master/docs/sel...), which is just one example of the kinds of customizations we want to enable.

Out of curiosity: are there any specific extensions from puppeteer-extra that you’ve used and/or would be interested to see?

sbergot · 6 years ago
Thanks for the heads up! Selenium tests flakiness is definitely a big pain for us. I am also a big fan of the puppeteer api. We will check it out.
lostintangent · 6 years ago
Great! Let us know if you end up having any questions/comments/feedback: https://github.com/microsoft/playwright.
jain_chirag04 · 6 years ago
Just tried the examples on our site and it works really well! Amazing project!

PS: I remember interacting with you from the early days of code-push I think :)

lostintangent · 6 years ago
Hey! I definitely remember you :) It’s always satisfying to run into the same folks across different projects, over the course of multiple years.

I’m glad to hear the examples worked out of the box! We’ve been iterating on the docs and API quite a bit (based on feedback), so don’t hesitate to let us know if/how they can be improved: https://github.com/microsoft/playwright.

ampdepolymerase · 6 years ago
Any plans for a visual editor like Kantu?
lostintangent · 6 years ago
Low/no-code authoring is definitely something we’re interested to explore. Once we’ve solidified the core Playwright library, we plan to build (and collaborate with the community on) tools that can simplify automation tasks even further, on top of a modern, reliable and performant core.

Are you currently using Kantu? If so, I’d love to hear more about your specific use cases, and which capabilities you’d be interested to see. Thanks!

prox · 6 years ago
Love the project, just installed it and trying it out now, got some nice results right away.
lostintangent · 6 years ago
Awesome! Please don’t hesitate to let us know how we can improve. We want to make web automation not only more reliable, but also more enjoyable. So we’re keen to hear how we can continue to push that goal forward :)

https://github.com/microsoft/playwright

jharohit · 6 years ago
Plugging another alternative to the horrible Selenium made by two friends of mine! https://uilicious.com/
hugs · 6 years ago
Just here to let you know the Selenium developers are human and read HN, too.
noeltock · 6 years ago
Doesn't seem open source?
dhruvkar · 6 years ago
>>my goodness, it'd be slow and potentially flaky all via the web UI for those sites

Generally, I've had better luck using undocumented APIs for this kind of stuff. I was a heavy user of Selenium to automate many a task (I work in wholesale construction goods, tons of automations needed everywhere).

But then discovered that using internal APIs (which surprisingly don't change much) is far easier than trying to exception manage changing UIs.

Open up dev tools on your browser and watch the GETS/POSTS as you complete your daily tedium. I use Python (usually just requests and beautifulsoup is enough) to mimic the calls and I have yet to find a use case where I wasn't able to automate something online.

I'm currently developing an SDK for our 18th-century ERP system, which has no API. I've also automated getting shipping container tracking data from a various shipping lines and railroad company websites, many with complicated login processes.

Happy to chat, email in profile.

ctrl4 · 6 years ago
Yup. I did this with a local Android app, that tells you the gps location of a public bus. I sniffed the http packets, found the requests i needed and made a python script that pinged me at slack when my bus was 5 minutes from my bus stop. Useful when I worked at night.
spikej · 6 years ago
I'm familiar with the web dev tools, but no clue about mobile. Can you point me in the right direction on how to do the same?

Were you using an android emulator on desktop or there's some way to easily do this on android?

dhruvkar · 6 years ago
Nice, that's the next step up.

Man-in-the-middle Android apps to discover (sometimes different API backend).

I did the same with a shipping line which turned out to use a SOAP backend.

beatthatflight · 6 years ago
(Facepalm)

I read your post.

Paused.

Opened up debugger on the site I'm currently selenium-ising.

reloaded.

boom. there it is. The request, and beautiful json response.

So...so..so much simpler.

Thank you, my evening is sorted ;)

dhruvkar · 6 years ago
Haha.. love it, I'm so glad it helped.

I had the same experience a couple years ago after spending months selenium-ing our ERP software.

2rsf · 6 years ago
Good point, using the APIs directly is the also the corner stone of stable test automation
tech_tuna · 6 years ago
Ha ha, yep. I do this kind of thing all the time.
cpclermont · 6 years ago
I have 141 custom scripts in my $HOME/bin. Most of it is in bash, but there's a couple of node.js scripts as well.

- I mostly automate my bookkeeping with a set of recurring & dependent taskwarrior tasks and scripts as annotations that I run with taskopen[1]. That's creating a bunch of folders, turning some emails in mutt into PDFs, gathering PDFs from emails, fetching bills with selenium, moving files from $DOWNLOADS into the appropriate bookeeping folder, putting a date on some files, turning the whole thing into a zip file, and sending it to the bookkeeper with mailx.

- I automated the email send of my daily summary to my clients with mailx (so I can send it directly from vim)

- I automated turning screen recordings into thumbnails+mp4 link (since GitHub only supports gifs)

- I automated making before/after screen recordings for when I do noticeable performance improvements (page load/animations)

- I automated booting/killing my development servers

- I automated making PRs with `hub pr` (finding the origin/upstream, putting labels, etc.)

- I bound to a key combo switching to the logs of specific development servers

- I turned my client's time tracking (tempo) into a CLI because I got tired of using the UI to say I worked X hours on that ticket and 7.5 - X on the other. Now I only do `tempo log $ticket1 2h $ticket2 3h $supportTicket rest`

[1]: https://github.com/ValiValpas/taskopen

YourMatt · 6 years ago
How do you like using Node for CLI? I started playing around with it a couple years ago, and at this point, I don't even consider BASH scripts if they involve the slightest bit of logic. Part of me feels like by going all-in, I'm going to lose touch with my ability to write direct BASH scripts, which are likely to work literally forever. Meanwhile, I expect my Node scripts to have a relatively short lifespan, particularly in that I'm leaning on NPM. It's been so nice though, I've decided it was a worthy tradeoff.
cpclermont · 6 years ago
I've been doing pretty much the same thing. If the logic gets crazy, of if I want lots of subcommands, I'd write it with node & commander. There's only so much you can do with `jq` when it comes to processing JSON.
klohto · 6 years ago
Would you be willing to share the code for Tempo automation? I am in market for the same thing.
cpclermont · 6 years ago
Sure! It's in my dotfiles. You can find it here [1].

There's the `excel` subcommand you probably don't need and you'll need to export the JIRA_TEMPO_USER and JIRA_TEMPO_TOKEN variables before running it.

- `JIRA_TEMPO_TOKEN` can be found in the Tempo Settings

- `JIRA_TEMPO_USER` can be found by inspecting the requests sent to tempo from JIRA IIRC.

[1]: https://github.com/charlespwd/dotfiles/blob/master/bin/tempo

EDIT: Confirmed, I found my `JIRA_TEMPO_USER` as the only accountID sent as parameter the POST https://app.tempo.io/rest/tempo-timesheets/5/private/days/se... when booting up the app in JIRA.

martin_a · 6 years ago
I run Home Assistant with Zigbee devices for automatic lighting at home:

- switch on when I get home and sun is set

- switch on when I'm home and the sun sets

- switch on in the morning, full brightness, coldest color to help waking up (really helps me a lot and is not as stressful as an alarm clock)

- automatically turn light off when I (my smartphone) leave home (not visible in the WLAN for 10 minutes)

Will look into more automations there. Perhaps something about turning the heat up in the bathroom in the morning when the windows are closed (there are sensors for that).

I ran NodeRed on a Raspberry Pi too for some time, but I found that helped me only little. Mainly did logfile analysis through that but did not look into other use cases for me.

For work I've got the de-facto standard for the printing industry, I'm doing everything possible with that.

mnbbrown · 6 years ago
Interested why you use the coldest colour for waking up? I do the same, but use a sunrise simulation instead that goes from warm to cold.
martin_a · 6 years ago
Hm, maybe it's self inflicted torture. I just feel uncomfortable with the blueish light and will get up quickly to leave that behind me. Maybe I will give your sunrise simulation a try, might work just as well, not sure.
sheepybloke · 6 years ago
Cold light helps you wake up in the morning, since it's more stimulating. That being said, it shouldn't be harsh like midday light; closer to an in between. I've heard it described as more of a green light than blue.
htk · 6 years ago
I manage a Family Office and do monthly performance presentations with PowerPoint, the slides have an unique design, and updating them every month became extremely tedious and error prone.

I was already looking for an excuse to learn Python and this was perfect.

Instead of recreating the slides I created templates (just the last set of presentations) and update them with info directly queried from the database, using python-pptx and pyodbc.

This isn’t exactly an example of a “tool”, but I think the most important part isn’t really the tool, but to be able to identify what you can automate. How you do it might range from DIY to paying someone to code for you, but the feeling after getting rid of manual processes is great!

cybrox · 6 years ago
From the past 10 years of side projects, I can definitely confirm that the most important skill one could have is recognizing what can be automated, and especially, what is worth the effort of automating. - Your example is definitely a good one!
tohs19 · 6 years ago
Also at an FO here, this is great. We started templating everything last year and it’s been a huge relief. Project management in Asana we also turned into templates, things are simple but flow so much easier.
excitednumber · 6 years ago
Nice! I work at a quant fund and we Python-pptx, too.
simbas · 6 years ago
Check out revealjs.com
excitednumber · 6 years ago
Reveal is good but very hard to recreate ppt slides.
vitro · 6 years ago
Yes, Xkcd has nice strip for this called "Is it worth the time?"

https://xkcd.com/1205/