How to detect button press

I would like to detect when a pysical button attached to my GPIO pin is pressed and then activate some python code.
I have noticed that there is an access limit on the API so i was wondering if there is another way to have it detected other then just repeatedly checking for a signal with digitalRead()??

Hi @volarismatthew,
You need to constantly read the pin to check for the status. If you need more API calls, consider upgrading to Bolt Cloud Pro. Do read the API access rules before writing the code.