Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Receive a webhook using trellinator

Carlos Pozos Ochoa June 6, 2021

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

0 votes
Dan Ivory
Atlassian Partner
June 7, 2021

@Iain Dooley Maybe one for you? 

Like Dan Ivory likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events