Getting Back into Writing
Once again, I have decided I’d like to write down more of my ideas and share them with others. I had setup a blog with Hugo and Netlify about a year ago but the free domain I used had expired and was now hosting porn ads.
I really liked the Hugo setup and ease of use, but I wanted to further automate it for the day to day and not require me to directly interact with a CLI or git at all, at least directly.
Previously, I was writing articles in emacs org mode, and using some org export mode to convert to the Hugo template. This was nice and sated my itch to learn more e-lisp, but ultimately cut against the ease of writing and publishing I was looking for.
The new goal would be to make the CMS be as flexible as possible. An .md file should be able to be dropped in a folder, globally accessible, that kicks off the static site generation and redeploy. I also was looking for a new comment system that didn’t require so much interaction with the git repo to update, moderate, etc.
Google Drive seemed like a good candidate for the folder piece. It’s available everywhere, has cross platform mounting options and I’ve been using ChromeOS more and more, which is obviously deeply integrated into Drive from the OS.
There was some kind of ‘listening’ integration on my previous site, but I used some free tier SaaS product to connect the two services.
“This time I’ll build that piece myself in a Google Cloud Function.” I said to myself as I donned my Icarus wings.
“How hard can it be to setup a webhook?” I thought foolishly. “I just need Google to tell me when a file gets updated!”
A Hellish Nightmare
Hey Service – Can you let me know when the mail arrives?
Sure thing – Here is a number you can call to get a special code and then call me back with that code and I’ll tell you when the mail comes.
Oh, and I need you to call me every hour and let me know you still want me to tell you when the mail comes.
Uhh - alright.
Oh, and when you call to get, the code, they’re going to give you another code and number that you need to call every 3 hours to refresh the code too, or I can’t let you know. But I’m definitely happy to let you know when the mail arrives!
I work in E-Commerce with application and web developers, but not as an actual SWE. I will write a piece on Sales Engineering sometime in the future. After having this experience trying and failing to navigate the OAuth complexities demanded by Google to receieve webhooks, I will never imply this stuff is so easy or simple to setup. I was pretty shocked at the lack of tools available from Google or elsewhere to do this easily and the lack of SO questions or other help on getting everything setup.
The number of times I have suggested to my partners and other developers they setup some kind of webhook integration willy nilly as if it’s as simple as making a request now haunts me. While the APIs I’m responsible for don’t have this level of rigor on the auth side, I failed to fully grasp the challenges when implementing this kind of thing for real. That can easily happen when you think about only architecture and not enough about the actual building.
The challenges were not insurmountable, but for setting up a tiny web server to listen to requests and pass them along to somewhere else, it was too much to justify not using some IPASS off the shelf.
Even then, while Google Drive technically supports webhooks and Google provides docs on this, the SaaS I’m using now to do the webhook does not even support the true webhook integration – They are simply building an index of files and seeing if they change at a regular interval. To make matters even more frustrating, even just to do that you need to go generate OAuth user credentials in Google Cloud so the authentication works correctly.
If you need to do something similar, I highly recommend using something like make.com instead of trying to figure this out yourself unless you’re building out client sites.
If there is something I missed that would have made this process simpler or even some community I missed with snippets and guidance on setting something like this up, let me know in the comments.