Could BOTs be triggered via the API

Hi

I’ve made an Appsheet App that shows news stories from keywords that I select. The source is a Google Sheet which updates via some Google App Scripts (fetching from SerpScale queries).

I would really like to configure some BOTs that send a push notification when certain stories are added to the sheet (like for example a story with a high number of social interactions).

However, BOTs are not triggeren when sheets are updated from outside of Appsheet.

So my question is: How can this be done? Is it at all possible?

It seems that I might be able to use the API and “just” trigger maybe an action from my Google App Script - is that a possibility?

If it’s not possible at all I think that this would be a really nice feature in the future.

1 7 482
7 REPLIES 7

An update. I’ve succesfully called the API

My strategy was to invoke a list action that “touches” all rows with a certain condition. However, I’m getting this error:

“Errors”: “Action ‘TESTAPI’ of type ‘REF_ACTION’ for table ‘News’ is not supported for the REST API.”

I think this means that I will probably have to update the individual rows via the Update action (instead of doing this natively in Google App Script).

Yes, I can confirm that this works. Here’s the Google App Script code for those trying to achieve this via the API:

  var options = {
    "method": "POST",
    "muteHttpExceptions": true,
    "contentType": "application/json",
    "payload": '{"Action": "Edit", "Properties": {}, "Rows": [{"[KEY]":"value","[COLUMN TO UPDATE]":value}]}',
    "headers": {
      "applicationAccessKey": "[YOUR API KEY]"
    }
  };

  var response = UrlFetchApp.fetch("https://api.appsheet.com/api/v2/apps/[APP ID]/tables/News/Action", options);
  Logger.log(response);

This is very impressive @Soren_Pedersen.

So, is this understanding correct that when records are added to the backend Google sheet, you are invoking a BOT through API call coded in Google AppS Script?

Once the BOT invokes, the notifications go to the users?

Yes that is correct. I’ve only tried this with a few test calls but it seems to work.

I don’t know if there are any API quotas or Push Message quotas though.

Thank you.

Please take a look at the last section in the article below

Yes. Recursion is certainly something to be aware of. But as long as you’re only adding/updating via the Google App Scripts and not invoking webhooks calling back the Google Apps Script - I think you’re okay.

Hi Soren,

I know this was a while ago, but I was hoping you could explain to me the code you wrote above. I tried to copy and paste it into Apps Script and modify it to work with my Appsheet and Google Sheet, but unfortunately I'm running into errors. Are you able to explain what of the code above I would need to replace with my own info (and what info that would be). THANK YOU IN ADVANCE!

Top Labels in this Space