Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Receive a webhook using trellinator

I have been trying to Receive a shopify webhook to my trellinator google app script. In my research I have found out that my code should run on doPost function and then send a 200 OK response.

I have performed some tests and my code is running fine, but the webhook keeps triggering as if it did not received the 200 OK response.

I know that trellinator uses doPost function to execute some code, and I do not know how to receive my webhook on top of trellinator platform. 

Below you can find the doPost function I am taltking about

function doPost(e)
{
var hooks = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Custom Webhooks");
var htmlOut = false;

//Here is were I execute my function
myFunction(e);

//My function ends
if(hooks)
{
new IterableCollection(hooks.getDataRange().getValues()).each(function(row)
{
if(this[row[0].trim()] &&(htmlOut === false))
{
htmlOut = this[row[0].trim()](e);
}
});
}

if(htmlOut === false)
{
if(e.postData)
{
var notifText = e.postData.contents;
var htmlOut = doPosting(notifText);
}

else
{
var htmlOut = HtmlService.createHtmlOutput("<p>Processed Notification</p>");
}
}

else
{
var htmlOut = HtmlService.createHtmlOutput("<p>Processed Notification</p>");
flushInfoBuffer();
}
return htmlOut;

}

1 answer

@Carlos Pozos Ochoa I'll reply here as well as in Reddit :)

Note that you shouldn't ever need to edit any of the Trellinator files.

This is an undocumented feature, but just create a sheet in your Trellinator spreadsheet called "Custom Webhooks" then put your function names in the first column, no header column. So in your case you would just enter

myFunction

into cell A1.

These functions will be called before the Trellinator notification processor, if you return "true" from your function, processing will stop, that is the notification will not proceed to be passed into your Trellinator functions.

If you return "false" then the notification will be passed onto your Trellinator functions. So an example of a custom webhook might be something like this:

https://gist.github.com/iaindooley/c344cc62c08858736ce18e8cf920c44e

 

Thank you Iain, I have tested the code you propose and it is executed right. The problem is that I should reply shopify in a 5 second window with the 200 OK response, but looking at my logs "myFunction" is taking longer than that time to reply, so the webhook is firing continously. Is there anyway I can add my function to your trellinator queue? So this way I can anwer inmediately to shopify and let my funciton execute later.

Iain Dooley Community Leader Jun 08, 2021

@Carlos Pozos Ochoa yep just use the same URL that is set up for all your other boards. You can see by running this piece of code:

https://gist.github.com/iaindooley/ee64dd680d1991ede55aa5cb7ef843bd

just grab your token from the Configuration tab and put it in there. You can use that webhook directly the same as you would use the published script URL, it just queues the requests and forwards them onto the script anyway

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

📹 Favorite Trello templates

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. In this video, I'll share my favorite Trello templates. Templates mentioned in ...

2,033 views 17 46
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you