How to use JSON Webhook workflow for an Update to an outside system

Hi everyone, I have an AppSheet webhook created with another site and the Add Record works perfectly. Now I’m moving towards being able to update the records I’ve added but wondered how AppSheet would work as I don’t see a GET option.

Does AppSheet have the GET capability already built in? If yes, how can I help it reference the correct record. I’ve reviewed the Webhook documentation for AppSheet but haven’t seen a sample of a JSON Update script here. Any references would be outstanding.

Thanks so much.

Here’s the error text.

Error:
“Webhook HTTP post request failed with exception {“name”:“Error”,“errorGroup”:“User”,“code”:“WD_VALIDATION_ERROR”} The remote server returned an error: (500) Internal Server Error.”

AppSheet does not have GET webhooks, but that is for webhooks sent from AppSheet to other systems.

If you want to send a webhook from another service to AppSheet, use the Edit-action in the webhook body. (The Endpoint URL is the same)

{
"Action": "Edit",
"Properties": {
   "Locale": "en-US",
   "Location": "47.623098, -122.330184",
   "Timezone": "Pacific Standard Time",
   "UserSettings": {
      "Option 1": "value1",
      "Option 2": "value2"
   }
},
"Rows": [
{
"Key": "VALID_KEY_VALUE"
"FirstName": "Jane",
"LastName": "Doe"
}
]
}

When you send an Add (row) webhook you can leave out the key-column, but you have to provide the key for Edit webhooks.

The webhook body for Edit is the same format except you need a key, and the Action = Edit.

Also, required values can be left out of the webhook body for Edits, as long as the row already has the required value. You only have to provide Key:Value pairs for the columns you want to edit.

3 Likes

Great information! I’m needing to send an UPDATE “from” AppSheet to another service. In my example, I will update records in AppSheet and look for that data to be updated in the other service.

Since AppSheet doesn’t have GET, what’s the best way?

Ah, sorry I misunderstood. That would either be a POST or PUT webhook from AppSheet to the external service, triggered on Table-Update in AppSheet.

What is the external service? Their API documentation should tell you how to format your webhooks coming from AppSheet.

1 Like

No problem, thanks. I have the script required on the other service. I’m looking for the JSON script needed within the AppSheet workflow since AppSheet doesn’t have the option for GET. I have this so far but unfortunately receive the error below which is understandable as I’ve not told the system which record to update. Hope this makes sense.

Error:
“Webhook HTTP post request failed with exception {“name”:“Error”,“errorGroup”:“User”,“code”:“WD_VALIDATION_ERROR”} The remote server returned an error: (500) Internal Server Error.”

You need to refine the JSON body. Visit the documentation for the template, as well as checking the useful tools @GreenFlux kindly provided before.

2 Likes

Nice! Ok, I’ll dig in to this tonight. Thanks so much!

Constructing JSON body is bit painful even on NO-CODE platform of Appsheet as it is bit “coding” flavour with it, but @GreenFlux made it less painful with his tool. Try it out.

2 Likes

I think this means that you’re not hitting a valid endpoint or the headers are wrong. If you get past authentication the errors are usually more specific. This sounds more like the URL or headers are incorrect so the specific server never gets a chance to respond.

Could you please post a picture of your webhook settings? The image above doesn’t show the URL.

1 Like

Nice Generator - will put to good use!! Here’s the image. I’ve seen other webhooks and see the need for the GET function in order to grab the correct record to update but when I generate the template, I receive the fields in the image.

Most API endpoint schemas have the record ID at the end of the URL for Reads/Updates/Deletes.

You may need to put the record ID after /updaterecords/<<[RecordID]>>. (External system’s ID, not AppSheet’s)


Where did you get the URL? It looks like it could be missing the table name to update as well as the key. And it could be a POST instead of PUT. It just depends on the API. Check the Wix API docs, or whichever 3rd party add-on you are using to expose the data.

Try sending test POSTs/PUTs from Insomnia. You can edit the URL formatting and retest much faster and figure out the right syntax, then paste it back in AppSheet.

1 Like

Ok, Will give it a try - a million thanks!