Google Sheet rejecting webhook posts

IGNORE. Found the issue. Now I need to figure out how to delete the post.

One of my Photon-based applications - let’s call it app #1 - has been using IFTTT to add rows to a Google sheet (to maintain a log of events) for years; no issues. But recently I decided to bypass IFTTT and its fees and post directly to Google via a Google app script webhook. I have a completey separate application - app #2 - where I have been doing that successfully for months.

To implement the direct-to-Google webhook for app #1 I simply copied the script from the sheet associated with app #2 (which I stole from someone else) and pasted it into the sheet associated with app #1 (script below). But it refuses to work. Invoking the webhook always results in error 401, indicating a rejection by Google due to the post being “unauthorized” even though I have granted all the necessary permissions on the Google side.

I have double-checked and triple-checked the URL and all the other webhook parameters and they are all correct and except for the URL, of course, are identical to te perfectly-functional webhook for my app #2. I completely removed the associated sheet from Google and the webhook from Particle and rebuilt them both from scratch. No change; I still get the 401 error.

I have looked at all the available documentation about Google script authorization and have found nothing that I have missed or not done correctly.

Can anyone here suggest a solution?

Hey, I looked at some of my notes from 10 years ago, so it might not work anymore like this but:

Did you deploy the Google app script to anyone? (anyone/public/something like that)

If that does the trick this is security by obscurity :expressionless:

EDIT: another note says:

click on Publish > Deploy as web app… For 'Who has access to the app:’ select 'Anyone, even anonymous’.

I am embarassed to the extreme Gus 'cause I now recall having the exact same problem with my first such webhook which, as I said in this post, is working fine. I'm so freekin' old (80) that nothing sticks in the brain anymore. When setting up permissions in Google's 'deploy' tool, there is an option to allow 'anyone with a Google account' followed by just plain 'anyone'. The latter choice doesn't appear unless you scroll up so I had selected the former option. Just 'anyone' works (of course). DUH!

1 Like

Case closed then! :flexed_biceps:

Yes sir! I'm in business. But many thanks as always for your assistance.