Get your Trainline and Wetherspoons Receipts in Monzo

I did some work over the weekend on a tool that would convert Trainline and Wetherspoons receipts into the Monzo app. It’s worked pretty well for me and I’ve put the source on GitHub here if anyone else wants to have a play with it and use it for their own receipts.

A lot of the other scrapers I’ve seen use Google’s APIs for accessing Gmail, this one connects through IMAP instead so it should work with pretty much any provider from the last 20 years. There’s some more info on how it works here.

If you’re a fellow dev, feel free to add any merchants in any other merchants you want, I’ll probably add some more as time goes on! It’s my first time using Golang too, so if I’ve committed any atrocities, please let me know!

Unfortunately, it doesn’t work with old prepaid transactions, as they just give a 403 Forbidden (not sure why as can’t see it documented).

Hope you find it useful too!

19 Likes

Isn’t thetrainline still a rip off?

2 Likes

Best UX of a ticket app I’ve found tbh, no booking fees on the day either. I normally save more finding their advanced tickets than I’d pay on the other TOC sites where they’re more buried

3 Likes

Where do they charge fees then? Do they automatically do split ticketing then?

Also, looking at your code it seems to just scrape emails? Is there no API available for when they change the subject line or the formatting?

I need a Dummies Guide coz I want Wetherspoons init

4 Likes

Fees are flat rate if more than one day away IIRC. Their thing shows the advanced variants of tickets by default which other TOCs don’t seem to.

No API is available for either transaction history or payments I’ve found (for any ticket reseller I’ve found), but for email/subject format the header bit changes but they’ve kept the same bottom content email formatting for at least 5 years, so it’s alright!

1 Like

Hopefully either Monzo or someone like Flux can pick something like this - doing email scraping up properly. Being able to set up emails to forward to them and they’d appear in the app would be really convenient.

1 Like

So is this not currently automatic?

1 Like

it can be automatic-ish, if you set it up in a lambda/azure function and set it to run every 24 hours. It’s what I’ve done - you can have it update and add new entries at midnight every day which is good enough for me until open receipts become big!

Hmmm. I suspect 99% of people will be skipping that option until more seamless integration is possible.

1 Like

Probably, but until then it’s a proof of concept and might be useful for other dev-folk!

11 Likes

I’d love Monzo™️ in-app Gmail/email scraping, would fill in a lot of the gaps from flux. Great work here though!

2 Likes

It would be super nice to have an org that specialised it 100%! Even as an alternative if merchants sent a receipt as a standard-format JSON file it would be nicer than scraping and better to parse!

1 Like

That’s way too sensible for almost all merchants.

3 Likes

True, but if someone like shopify started including it in automated emails by default it would be a big step towards it. Doesn’t even need to be an attachment either, could be a custom meta tag with a link hidden so not to confuse customers - but yeah, adoption would be hard.

2 Likes

Not 100% convinced that email is the right medium for this but unaware of alternatives that don’t need to be built from the ground up.

How much (and what type of) metadata can merchants/banks access/share in a transaction?

2 Likes

I know that airline tickets have some extra detail in the transaction itself (there’s a specific topic that covers it somewhere) so if you buy tickets with your monzo card you can see “some” flight info (I think it gets put in the notes?)

The real issue is getting merchants to expand the transaction info (for Monzo to then handle this automatically). I imagine the majority are happy that receipts fulfil this purpose, so there’s little incentive for them to put in the work.

Edit: Here it is:

3 Likes

I think the long term solution would be passing it over the MasterCard network as a list so any bank can pick it up, I don’t think there’s currently any provision for passing that type of data over their network beyond the transaction name (not that my Googling has found anyways), @Rika do you know if it’s possible to pass that?

However, I’d guess that this type of solution would mean quite a big change to PoS itself, as readers would have to be passed the full list of transactions instead of just a total amount.

Google has this covered with schema (https://developers.google.com/gmail/markup/overview)

I remember writing Gscripts to mimick schema emails so that non-schema emails triggered certain fields and emails got auto-bundled to the trip bundle in Google Inbox.

Quite clever really. I may revisit schema (with Gscripts & Monzo) to see if something can be done.

2 Likes

Happy birthday BTW!

2 Likes