Skip to content
Swizec Teller - a geek with a hatswizec.com

Can you automate love?

Friend, what's the laziest thing you've ever done?

The internet's best answer is this legendary officer who ordered a ship to change course to get the morning sun out of his eyes.

But we're engineers, our lazy looks like this ๐Ÿ‘‡

ion 2xpng348731

You get tired of a task, start to automate, continue to automate, keep going, and wait what was the task again ...

After 24 years of coding I've got lots of those stories ๐Ÿ˜…

Like when I replaced a $6000/year editor with a $2/year gaggle of JavaScript. Great use of serverless.

Or when I was broke and built a bot that emailed me from the future. "hey Swiz, if you keep going like this you'll be broke

That was fun. Designed my own machine learning financial projection algorithm and everything!

The Google interviewer said: "Don't mention interest in machine learning on your resume if you have no experience". ๐Ÿ˜‚

Rude.

Serverless Handbook

Learn everything you need to dive into modern backend. Understand any backend

these chapters gave me knowledge which is sufficient to build real products and the hand-drawn diagrams and high-leveled descriptions gave me the feeling that i don't have any critical "knowledge gaps"

Launching soon, be the first to know.

Join over 10,000 engineers just like you already improving their careers with my letters, workshops, courses, and talks. โœŒ๏ธ

Or that time I used AWS Lambda and Twilio to answer the door. Callbox calls a Twilio phone number, Twilio pings a Lambda, Lambda sends you a text, answer the text, door opens.

No more phone calls from packages!

Then I realized you can add the gate code to your address and delivery people let themselves in. Even easier ๐Ÿ˜‚

But it was fun to build.

Been meaning to automate feeding treats to Kiwi ๐Ÿฆœ and got stuck on "Oh right, I don't know robotics ...". Wouldn't that be cool though? Build a robot arm that listens to audio cues and feeds your bird treats so he goes back to his cage instead of destroying the cabinets.

But I digress.

Here is the coolest most laziest almost-finished automation I've ever attempted ๐Ÿ‘‡

Automating love with serverless

For Valentine's Day this year, I got a Lovebox for The Girl. A cute little IoT device that spins a 3D printed heart and shows photos from an app.

She loved it.

And she loved it even more when I said "I'm gonna build a bot to make sure you get a new photo of our relationship every day"

Lovebox has no API and I spent the first 3 hours of this project reverse engineering their GraphQL API. Learned a lot!

Like did you know encrypted https traffic is easily snooped on when you have physical access to the client? ๐Ÿคฏ

Finding this GraphQL mutation was the hard part:

mutation sendPixNote(
$base64: String
$recipient: String
$date: Date
$options: JSON
$contentType: [String]
) {
sendPixNote(
base64: $base64
recipient: $recipient
date: $date
options: $options
contentType: $contentType
) {
_id
type
recipient
url
date
status {
label
__typename
}
base64
__typename
}
}

The rest was easy:

  1. Install graphql-request, a smol graphql client
  2. Init with a snooped JWT token
  3. await client.request(mutation)
  4. sls invoke -f sendNote

And a Serverless AWS Lambda wakes up on your machine as if it was running in production. 30 seconds later, the Lovebox spins ๐Ÿ˜

Next step: S3 bucket with a pool of photos and a daily trigger.

What do you think, will this work? hit reply

Cheers,
~Swizec

PS: I'm doing a live serverless Q&A on Monday, you should join :)

PPS: look what arrived in the mail! more on this next week

Did you enjoy this article?

Published on March 17th, 2021 in Serverless, Technical

Serverless Handbook launching soon

Leave your email and be among the first to know when Serverless Handbook launches.

The perfect resource that shows you how to jump into modern backend and understand any backend. A why and how book.

Serverless Handbook

Learn everything you need to dive into modern backend. Understand any backend

these chapters gave me knowledge which is sufficient to build real products and the hand-drawn diagrams and high-leveled descriptions gave me the feeling that i don't have any critical "knowledge gaps"

Launching soon, be the first to know.

Join over 10,000 engineers just like you already improving their careers with my letters, workshops, courses, and talks. โœŒ๏ธ

Have a burning question that you think I can answer?ย I don't have all of the answers, but I have some! Hit me up on twitter or book a 30min ama for in-depth help.

Ready to Stop copy pasting D3 examples and create data visualizations of your own? ย Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization

Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.

Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first ๐Ÿ’ฐ on the side with ServerlessReact.Dev

Want to brush up on your modern JavaScript syntax?ย Check out my interactive cheatsheet: es6cheatsheet.com

By the way, just in case no one has told you it yet today: I love and appreciate you for who you areย โค๏ธ

Created bySwizecwith โค๏ธswizec.com