Just add the following files at given locations: all credits to @guihkx for solving this issue
save your-uploader.desktop to ~/.local/share/applications/. edit it accordingly. make note of Exec=xxx section. it should be the name of next file
save myuploader to either ~/.local/bin/my-uploader or anywhere in your $PATH. edit it accordingly. most probably you don't need to change anything besides the curl command on L20
after saving both files, run update-desktop-database ~/.local/share/applications and chmod a+x /path/to/myuploader
Then, when you take a screenshot with flameshot, just click on icon that says "Choose an app to open the capture". You will see your custom application there Click on it, it will upload the file, and copy the response of server to clipboard.