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.

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).

1 Like

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);
1 Like

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?

2 Likes

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.

1 Like

Thank you.

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

2 Likes

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.

1 Like