Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Butler button get an external redirect uri

Jiajie Liu November 23, 2019

Hi,

I'm trying to create a board button that sends a get request to my Google App Script(GAS). GAS always generates a one-time accessing uri and returns as response 302. Unfortunately, butler doesn't recognize it and treat it as an error. Does anyone know how to recognize a redirection response and proceed the execution with redirect uri?

Thank you in advance!

1 answer

1 accepted

2 votes
Answer accepted
Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 23, 2019

@Jiajie Liu Google Apps Script doesn't generate a one-time access URL if you deploy it as a web application

Jiajie Liu November 24, 2019

Hi Iain Dooley!

Thank you for you reply!

I deployed it as a web application and I have an URL like this
https://script.google.com/macros/s/<somethinghere>/exec
and it returns a redirect response to
https://script.googleusercontent.com/macros/echo?user_content_key=...

The script executes as Me and anyone even anonymous can access to the app since I don't know how to do OAuth in bulter.

I think this Google App Script related question should not be asked here so is there any way to handle the response 302 in butler? Or other power-up that I could do some coding inside.

Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2019

@Jiajie Liu looks like this is only the case when you serve the request using the Content Service:

https://developers.google.com/apps-script/guides/content

If you serve the request using the HTML Service instead you won't get the redirect:

https://developers.google.com/apps-script/guides/html/

Like Jiajie Liu likes this
Jiajie Liu November 24, 2019

Thank you so much! It works now.

Thank you again for helping me to solve my problem even it's not about trello.

Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2019

@Jiajie Liu haha yeah I do a LOT of work with Google Apps Script, in fact I created this framework for automating Trello "butler style" using GAS:

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Introducing-Trellinator-Automate-Trello-with-Google-Apps-Script/ba-p/925271

Jiajie Liu November 25, 2019

Wow, That's cool! I should use it I think.😆

Eduardo Sanzio August 11, 2023

Ok, after 4 hours trying to link a simple GAS script to Butler via GET Rest, this answer is the closest thing I can get from solving my problem, but not quite there yet....

In my case I get the Error 302, and my code was

return ContentService .createTextOutput(JSON.stringify({"result":"success", "novocnpj": novocnpj})) .setMimeType(ContentService.MimeType.JSON);

novocnpj is the variable that I want to get back to Trello using httpresponse

When I change to HTML Service the only way is like below:

return HtmlService.createHtmlOutput(JSON.stringify({"result":"success", "novocnpj": novocnpj}));

But that also doesn't work.... it services a webpage and not a JSON... so httpresponse doesnt work

please tell me what I am missing

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events