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, join the Smartsheet Guru Elite
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
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives