APIs and Webhooks
Over the last couple of years, I have been thinking about ways to develop more coding skills and put them to practical use. If I can build something, I know I’m understanding it.
A couple of years ago I started looking at documents or data that I was putting together (or asking others to gather) and realizing how much time this was taking and how often the information was inaccurate — largely due to the manual process. I started using a Google Sheet add-on called API Connector (I’ve mentioned it before). It is well designed and frequently updated and for a few dollars/month, it is a good investment.
Generally, I have the API set (I have used Postman and Paw to test and verify my API call) and then when I have a need for some new data, I run the script and review it. Lately, I found a few areas where I have scheduled the script to run daily and then pull the data into various Google Sheets. With this, I can look at a “total” sheet and look for any dramatic changes that warrant further research.
This last week I dug into Webhooks some and have been very happy with the outcome. A few things I found in this process are the ability to “see” what the system is sending (so you can parse the information effectively). This website (webhook.site) provides an endpoint that gives visibility into what is being sent and how it is being received.
Once I had this, I did some reading about using Google’s Apps Script to receive a Post request from the webhook and enter a row into a sheet. The script is very simple and works well.
The problem I was trying to solve was we have a sheet that following the repair of a laptop display, we note the student, the cost, the date, and general details (notes, school division, and tech). I have been trying to connect support tickets to it too for accounting purposes but with any manual process, the results are incomplete and inconsistent.
The webhook will fill in the date, name of the requestor, the tech and division, and notes along with ticket number and link to the ticket. I’m having an issue with the JSON formatting to grab the serial number, but that would be the trifecta.
If the system is being used to capture the support ticket, the sheet will be updated for administration and the business office to review and pay as needed.
I’m happy to share more information and discuss — would love to learn more. Hope this brings about some thoughts and interest.