Trigger a request after environment change?

I have two environments: staging and production. I have a POST request that generates an access_token (and saves it to an environment variable) for the selected environment.

Is there a way to have the post request triggered when the environment changes?