Can this be done with Drafts 5?

I would simply the URL slight using Drafts’ template engine’s built-in ability to do URL encoding with {{ }} curly braces, like:

anki://x-callback-url/addnote?profile={{User 1}}&type=Basic&deck={{Stock Market Learning}}&fldFront=[[title]]&fldBack=[[body]]

To clarify what is happening here…

The value is a template for a URL. When Drafts runs the action, it runs that template through it’s template engine, and substitutes values. The [[body]], [[title]] are template tags and Drafts replaces those values with the appropriate text from your draft.

In the case of URL action steps, if you have the “Encode tags” option on (the default), Drafts will also automatically URL encode the text when substituting those tag values, so they are all ready and valid to be a parameter in a URL.

You also have included some static parameter values in your URL (“Stock Market Learning”, “User 1”) which have characters which need to be URL encoded. You can manually encode those values, or the template engine has a special syntax using double curly braces, that will encode the value in the braces (removing the braces in the process), so {{User 1}} will become User%201 in the resulting URL.

There is also another slightly easier way to manage this that keeps the URL from getting too complicated, which is to use the Define Template Tag action step to define the values you need to include in your URL. In this example you might have a define template tag step with the tag name “deck”, and the template “Stock Market Learning” - then in the URL template you can use [[deck]] instead of deck={{Stock Market Learning}}