SmartSheet webhook -> Google Apps Script verification
Hello,
I'm trying to set up Smartsheet's webhook listener using Google Apps Script, but having an issue with the verification step.
My code looks as follows:
function doPost(e) {
var challenge = JSON.parse(e.postData.contents).challenge;
var response = JSON.stringify({'smartsheetHookResponse':challenge});
return ContentService.createTextOutput(response).setMimeType(ContentService.MimeType.JSON);
}
The error I'm receiving when trying to activate the webhook is "Request returned HTTP status code 302" which I believe is due to this part:
"For security reasons, content returned by the Content service isn't served fromscript.google.com
, but instead redirected to a one-time URL atscript.googleusercontent.com
. This means that if you use the Content service
to return data to another application, you must ensure that the HTTP client is
configured to follow redirects. For example, in the cURL command line utility,
add the flag -L
. Check the documentation for your HTTP client for more
information on how to enable this behavior."
Is there a way to make Smartsheet follow the redirect to receive the challenge or create HtmlService.createHtmlOutput that is a vaild response (as the HtmlService is not redirecting)?
Answers
-
@Michal Bukowski
Unfortunately no. A couple years ago I verified with Smartsheet this can't be done.
So, unless there has been an update, but I doubt that…
You'll have to use a static endpoint for a webhook, which means you can't use Google Apps Script.
Darren Mullen, smartsheetguru.com
Get my 7 Smartsheet tips here
Author of: Smartsheet Architecture Solutions
-
Thank you Darren,
My workaround was setting up a "middleman" in the form of FastAPI on Google App Engine.
It receives webhook events, processes them and sends them over to GAS.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.8K Get Help
- 376 Global Discussions
- 207 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 284 Events
- 33 Webinars
- 7.3K Forum Archives