To use this cloud function follow these steps:
- Create a pub/sub topic which will be used to trigger the cloud function.
- Create the cloud function and copy in the code below.
- Set the trigger to Pub/Sub and choose the topic created in step 1.
- Set the Runtime to Python 3.9 and delete default files.
- Create each file manually and paste the code.
- Make sure to set the correct project ID in line 8.
- Create a cloud scheduler job to trigger the cloud function on a regular basis.
- Choose the frequency when you want the cloud function to be triggered.
- Set the target to Pub/Sub and define the topic created in step 1.