For example put it into: /etc/pacman.d/hooks/spotx.hook
Tested with spotx-git + spotify AUR packages.
This hook will re-run spotx after every Spotify or SpotX update (both of which warrant it, as Spotify will override the files to stock, and updated SpotX might fix bugs or add support for new Spotify versions).
The -f flag has to be used, since otherwise the script will exit with an error after SpotX was updated, but Spotify was not, the error informing you that the patch was already performed. The -f flag will cause the SpotX script to firstly restore the backup that it has previously made, and only then apply the patch, ensuring that the patches apply cleanly on the current version once again.