I didn’t find anything in the Action Directory, so thought I’d raise this query here.
I’m struggling a little with using the URL callback scheme to perform this (simple) operation:
Send contents of current draft to Apimac’s Clean Text to have a text-manipulation performed on it, then Clean Text to send manipulated text back to Drafts as a new draft.
Clean Text has its own URL scheme as documented here:
I can get the draft into Clean Text and have an action performed on it (nominated within the URL) but I’m struggling to get the text back into Drafts again.
Ultimately, once getting the back and fore working, I’d add a prompt to the action for the select few manipulation types that I’d likely use in Clean Text which would change the URL.
Any guidance on how to complete would be appreciated.
This is untested, but from a quick read of the docs you linked to, I believe the best setup would be an action with two steps as follows…
Step 1: Callback URL
Configure the callback url step with the following URL and “Wait for response” enabled (replacing “uppercase” with the action you want to run:
Step 2: URL
URL step configured with Drafts’ own create URL, and the result returned by Clean Text:
The callback URL step will create the
[[callback_result]] tag to contain the result parameter returned by Clean Text.
This could be done other ways, but this seems the most straight forward.
Thanks for your help on this. I’ve run the 2-step action as per above. It doesn’t fall over, but on the other hand, it also doesn’t bring the manipulated text back from Clean Text to Drafts.
For both the callback url and url actions, I’ve got both options toggled on. Not sure if there’s anything else I can change my end.? Not the end of world if I can’t get it going; just thought it would be nice to tap in to Clean Text.
Can you share the action as you have it? You can post it to the Action Directory as an unlisted action and share the link here.
You have to disable “Open in Drafts” on the URL step. That should error out, you hit a bug, but it’ll work find if you disable that. That feature is for opening an HTTP/HTTPS url in safari without leaving the app and will not work with non-http URLs.
Great stuff. That works. Many thanks for your time. Cheers.
Tried to see if I could incorporate the prompt with this. I added a couple of Clean Text’s manipulation actions as buttons and then tried to substitute into the callback URL. However, I’m now getting:
“[“result”: “Unknown action. Please check the syntax.”]
Callback returned error.”
Here is the link for the action uploaded to the directory. Would appreciate it if you could flag if anything looks awry here.
That sounds like Clean Text doesn’t recognize the command you are requesting. Maybe case-sensitive?
Marvellous. That’s it. The actions are listed in the app in the cases as I entered them. This obviously doesn’t apply to the URL. Thanks again for resolving.