Not sure how new you are. Did you copy ALL the code I posted (it’s easy to miss a bit)?
This might help if you are not used to adding smartapps: