Automatically create card from selected text with Siri Shortcuts?

Dear Anki-users,

I’m looking for a way to create Anki cards automatically from selected words/sentences in Safari and other applications on my iPhone.

There is such a possibility with AnkiDroid: you just tap the word/sentence and press Anki in the pop-up menu, then AnkiDroid opens up and a new card is created with the selected word/sentence in the top field after which the device switches back to the first application again. But I haven’t found a way to do it with AnkiMobile. I often make cards this way to improve my vocabulary in foreign languages, and automatising the process would be a real time saver!

As far as I can see, it should be possible with URL schemes in Siri Shortcuts. In the AnkiMobile manual there is section about it (16. URL Schemes). I’ve tried with the example scheme that is given there:

anki://x-callback-url/addnote?profile=User%201&type=Basic&deck=Default&fldFront=front%20text&fldBack=back%20text

If I create a shortcut with this scheme and put it in the Share meny, I can easily generate new Anki cards from most iPhone applications. However, I can’t figure out how to automatically insert the selected word/sentence into the Front field instead of the example text “front%20text”.

Does anyone know how to do it? Or is there any other way you could achieve the same thing?

It may be possible by constructing the callback URL from the shortcut input, after URL-encoding it. The shortcuts forum would be the best place to ask for assistance here. If you do figure it out, please post your solution here so that others may benefit from it.