↗️ Webhook Action Tutorial

Okay, so if I’m understanding correctly, what you need to do is send the values of several new rows as a parameter (or series of parameters) to your webhook, yes?

What about if you were to generate a Joined List column and use that?
With a joined list, you can reference columns in any table, so getting at the data you need shouldn’t be a problem. If it needs to be filtered, then you could create template columns in each of the source and target tables, create a relation using those two template columns, and then build your joined list through that relation.

Would that work for you?

Hey Manan, I found a way to trigger script from webhook action.
It’s by Deploying it as a web app.

Let’s have a look at the code of the WhatsApp Message trigger.



function doGet(e) {

return ContentService.createTextOutput("This is a GET Request!");

}

function doPost(e) {

var body = JSON.parse(e.postData.contents);
Logger.log(body);
var name = body["params"]["Name"]["value"];
var message1 = body["params"]["Message"]["value"];
var number = body["params"]["Number"]["value"];

var payload = {
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD",
    "receiverMobileNo": number,
    "receiverName": name,
    "message": message1,
    //  "message": message2,
    //  "filePathUrl":image,
}

var options = {
    'method': 'post',
    'payload': payload
    // 'contentType': 'multipart/form-data',
};
var url = "https://app.messageautosender.com/message/new";
var response = UrlFetchApp.fetch(url, options);

}

After Saving this file, click on Deploy (Blue Button on right side of the script window)
Then, Add deployment as a web app,
Change Access to anyone, and tap deploy.
Copy URL and paste it to Webhook Action on Glide.
That means It’ll trigger this web app URL when clicked.

Important: You’ve to deploy every time when you change the code snippets.

Paste any kinda function to doPost() function, you can trigger that from the glide app.

9 Likes

Yes, thank you! The joined list was the key.

I’m not sure if I’ve implemented the sequence in Zapier in the most efficient way, but it’s working! The sequence: add a new item from a form in the app, custom action adds three events (rows) to the calendar sheet, then triggers the webhook with the value set to the joined list of all three events. Then in Zapier, split text action to split the joined list into three items, split text action to split the first item, create google calendar detailed event, split text action to split the second item, create google calendar detailed event, split action to split the third item, create google calendar detailed event. (It seems like I should be able to tell Zapier in one action to create a google event for each item, but I couldn’t figure out how to do that).

Btw, I wasn’t able to create a new webhook in the custom actions editor. I made a button on a hidden tab and configured the webhook there, then was able to select the webhook in my custom action. Not sure what I was doing wrong there.

Thank you again for your help.

2 Likes

Really cool :sunglasses: now this is worth playing with.

1 Like

Wow this changes the game for many of my apps!
Thanks for this.

4 Likes

Also, this method looks a like cost effective. Even Rapid too.

2 Likes

Yeah, that’s a known issue

Glad you got it working :+1:

1 Like

I am following the original video steps - and Google introduced new steps in the process to connect with Integromat. The process to set this up for a gmail account is relatively straightforward, well(enough) documented, and is available here - Connecting Integromat To Google Services Using a Custom OAuth Client – Integromat Support (it worked for me - a short 10 min detour as I follow @Robert_Petitto 's original video very slowly)

2 Likes

@Purvang_Joshi, I use few third party add-on in my Google sheet. Is there any way by which I can trigger it based on webhook?
Currently it has time-trigger and google form submit trigger.

Yes. You can call that third-party function to your doPost() code.

Just call a function like apipheny(“Strings”) in code.

I haven’t tested it yet, let me know if you achieve it.

You can use Calndr and forget about webhooks, just add a button that says add to calendar linked to the calndr link

I am sorry but I have no idea about google scripts. Almost a zero knowledge in Appscripts and coding. Would be grateful if you can help me with it.
Also, I do not have any additional code in my sheet except that of Add-on.

Just FYI, I am using “Autocrat”, Document Studio etc. add-ons in my google sheets.

Its okay. I’ll work out on this and let you know soon.

2 Likes

Thanks

hello here is a prototype script for managing the Webhook
in google script use the web application deloyment.
It’s an example.
Replace the EventName and Pdf parameters with your own parameters

function doPost(request) {

  /** ****************************************
   *  WebHook, Column API
   *  ****************************************
   *  
   * Call WebHook : 
   * https://script.google.com/macros/s/ {id} /exec
   * 
   * Call Column API :
   * no 
   * 
   */

  var jsonContents = JSON.parse(request.postData.contents);

  // Glide Header
  var appID = jsonContents["appID"];
  var timestamp = jsonContents["timestamp"];
  var idempotencyKey = jsonContents["idempotencyKey"];
  var hookKind = jsonContents["hookKind"];
  var params = jsonContents["params"];

  // Commun Webhook & Column API
  if (( appID == null || appID == " ") ||
      ( hookKind == null || hookKind == " ")) {
   
    // error
    // TODO return error
  }

  // Glide Parameters
  var glideParams = JSON.stringify(params);
  glideParams = JSON.parse(glideParams);
  
  // Log
  var ss = SpreadsheetApp.getActiveSpreadsheet(); 
  var sheetLog = ss.getSheetByName('Log');
  sheetLog.appendRow([new Date(),hookKind,timestamp,params,idempotencyKey,appID, JSON.stringify(request)]);

  // Process Values
  // --------------
  
  // Glide Value
  // si la valeur dans glide est empty, le parametre n'est pas inclus
  try {
    var eventname = glideParams["EventName"]["value"];
  }
  catch (e) {
    var eventname = "";
  }

  try {
    var pdf = glideParams["Pdf"]["value"];
  }
  catch (e) {
    var pdf = "";
  }
  
  // Endpoint 
  if (hookKind == "api-column")
  {
      // TODO Column API return params type:string, value:xxxx
  };
  
  return; 
 
}
1 Like

Hey, How to return value to the API Column?
Can you give an example?

Hi,
I don’t have a solution for API column return values ​​yet.
I’m waiting for an official version to do a real test.

1 Like

I haven’t found a way to call a function to autocrat or document studio from webhook action. There isn’t any option or any document mentioned on their docs.

Btw I’m using apps script and webhook action to alternate autocrat. I’ll share the script for sure.

Thank you Purvang for your time.

1 Like

sorry @Purvang_Joshi
I haven’t seen your script, I posted something very similar.