It just clicked to me that when making an API call, the “Action” we’re providing for the API call (add, edit, delete, find) is literally the name of the action (add, edit, delete - not find though, lol) in the Action panel for that table. 
When we say:
sendToAppSheet(“Add”, “user@email.com”, “myAppId”, “myTableName”, “myAccessKey”, {“Locale”: “en-US”, “RunAsUserEmail”: useremail}, [{“Column1”: “Value1”, “Column2”: “Value2”}]);
We’re really saying:
- Go to the Actions panel
- Run the “Add” action
- Use the following values for the columns
And the system does exactly that!
- It essentially “pushes” that add button
- The form conceptually opens for the bot
- The bot enters the details you provided into the columns
- The bot hits save, and whatever automations are triggered
- Thought any form save events won’t fire off, since we’re not really inside the form.
- Thought any form save events won’t fire off, since we’re not really inside the form.
The revelation
A way of thinking about this is: we’re actually pressing action buttons through the API.
When we want to add a record, we’re pressing the action:
- We’re literaly pressing this button
And when we’re making an edit…
And when we’re deleting a record:
Putting it all together
So this means that we can hit ANY (???) action button through the API?
The documentation reveals some restrictions, but essentially… YES!
So if I wanted to mark a newly paid subscription in the Answer Portal as Active… and I have a button that I already press…
Can I basically hit this button with the API, say from a script?
YES!!
- This button only executes a data change action, which changes the status to “Paid”, sets the start date to
TODAY()
, and sets a trigger value for an automation bot.- These action types are within the limitations; so, yes, this “should work”. (^_^)
Testing proves true
- I was able to take my Stripe payment catcher script, adapt it to send a trigger to the AppSheet API when someone pays their subscription, and just ran a test.
- Indeed; the system worked.
It was able to take the email from the Stripe webhook, execute a “Find” appsheet call to find their unpaid subscription record…
Then take the ID from that record and run the data change action (from the button I press to activate the subscription),
This updated the record - and triggered the bot, which then kicked off the complicated chain I’ve already got built to handle everything - just as if I had gone into the app and pressed that button on that record.
wooHOO!
This opens up so much more flexibility and possibilities.