The key column is not found in recieved data, when call a webhook with a bot.

What I want to do :

Call a doPost function in GAS triggered by the addition of data.

Let the function recieve the key column of the added data.

What I tried :

I tryed creating a bot with an event and a process shown below (Nothing special).

ๅ›ณ2.pngๅ›ณ3.png

 

 

 

 

 

 

 

 

 

 

 

 

And created a container-bind script shown below.

 

 

 

 

 

function doPost(e) {
  const paramStr = e.postData.getDataAsString();
  SpreadsheetApp.getActiveSpreadsheet().getSheets[0].getRange('A1').setValue(paramStr);

}

 

 

 

 

 

Result : 

The function doPost did not recieve the key colum even though recieving other columns.

ๅ›ณ1.png<-- paramStr

 

 

 

 

 

 

I found an article that refered a similar problem. But it did not helped my problem.

Can you tell me if I'm doing something wrong?๐Ÿ˜ข

Thank you for reading to the end despite the poor English๐Ÿ™‚

0 4 81
4 REPLIES 4

You didn't put anything in the Body of the webhook.

Thank you very much for replying.

I tryed now to put body  in the body column and I could get any column I like incuding the key column.

But the question why the default body does not include the key column is remaining.

It looks like there are two misunderstandings here with you.

First of all, your task setting is to call a webhook, rather than call a script. If you wish to run and trigger the GAS, you need to set task up with call a script accordingly.

Secondly, what you can trigger from AppSheet is standalone script. Your script seems to be binded to a certain files, which could not be triggered from AppSheet for the moment.

 

>>"But the question why the default body does not include the key column is remaining."

Did you have that column set as hidden?

------

@Koichi_Tsuji , the method he is using is the old method for calling a GAS from a webhook, instead of the new functionality. They are both perfectly valid. You even gave a perfectly good reason to use the former in your second statement.

Top Labels in this Space