Hello Drafts Community,
I’ve been using drafts for a while now and started to harness its real power by creating some actions. The latest action I created does however not really perform as I hoped…
The action is to fetch the email address of a person who’s name is in line 2
In drafts I create a note where the email subject is on line 1, the full name of the person I write to is on line 2 and the content of the email is on line 4 and after.
I created an x-callback action to Workflow (now Shortcuts) which uses the input on line 2 to get the email address from my contacts. This works perfectly and I am returned the email address of the person I entered on line 2. However the result is not inserted after the name but at the end of the document. This becomes a problem when I use my second action which sends the entire content of the note to my email (line 1 subject, line 2 recipient, line 4 and after email content).
As the email address is not inserted on line 2 my second action does no work properly and the email address is in the emails content instead of being in the “to” section of the email.
So my question is, is there any way I can tell the callback to insert the result of the Workflow query after the name on line 2? If not possible in the callback, could this be done using a script bearing in mind that I am still on Drafts 4.
URL:
workflow://x-callback-url/run-workflow?name={{Drafts: get email address}}&input=[[line|2]]&x-success={{drafts4://x-callback-url/replaceRange?uuid=[[uuid]]&start=[[selection_start]]&length=[[selection_length]]&retParam=result}}