Sending clipboard data to Airtable - how to get message if http request not successful

Total noob here. I managed to create KM flow reading clipboard and sending it using Shell Script into Airtable by using the instructions here.

It works fine!

https://wiki.keyboardmaestro.com/action/Execute_a_Shell_Script#Quoting_Strings

What I want:

How do I know it the data was sent?

Ideally I would like to see a small toast window similar to one showing on the Android app called HTTP Request Shortcuts (or HTTP Shortcuts) showing for 2-3 seconds saying the text was successfully sent to Airtable, however I know this is most likely not possible to do on MacOS (not running the latest version).

So since I can't get the toast message, I would like KM to show an alert if there is an issue. So I want to add to my KM flow a condition to show me an alert notifying me, if the request was not successful (e.g. a failure of some kind).

I guess Airtable API offers some kind of feedback saying "Successful", but I could probably just read the output in KM and watch if it includes some words from the output such as "record ID" since that indicates the record was successfully created.

How do I add that step in the flow?
I assume I need to read that output, put into variable and then check if the variable contains the text?

When you https POST with curl it will send the server response to "standard out" -- you should be able to test this in KM by setting the "Execute Shell Script" to "Display results in a window". (Hopefully curl is the last/only action in the shell script, otherwise you'll have to redirect the output and get it later.) You may need to include the -i flag in your curl command so that it outputs response headers.

Once you've got that working you can change the KM Action to "Save results to a variable", then test that variable in the usual ways.

Solved, great. Works.
One more question.

I have condition step checking if the variable (comes from %SystemClipboard%) is non-empty and the KM flow will stop if it is empty. That is if I didn't copy any data to clipboard prior to starting the KM flow, the flow will stop.

The issue is however, with non-text data in system clipboard. Is there a way to check the variable to validate if the variable includes text data?

That is I want to make sure my KM flow does not run if the clipboard contains picture. Even if I add condition to check if the variable is non-empty, if the clipboard contains picture, the flow will still run.

Before you copy the clipboard to a variable, do the test directly on the clipboard, as follows:

Click on the word "contains" and choose one of the first two options.

Screenshot 2024-04-03 at 20.10.32

1 Like

Very good. Thank you.