Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Labs

Sending SMS Text via Cloud Functions

Cloud Functions are, in a way, the glue between services. These services are often other ones on Google Cloud – but they don’t have to be. This hands-on lab will explore integrating Cloud Functions with one of them: Twilio, a web service API for SMS, voice, and other communications. With the help of this external service, we will set up a Cloud Function that, when triggered by the upload of an object to a Cloud Storage bucket, sends a text that alerts one or more recipients of the action taken — complete with details about the object. Note: Because of the Twilio limitations, this lab will only work with telephone numbers from the U.S. and Canada.

Lab platform
Lab Info
Level
Beginner
Last updated
Apr 06, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Enable necessary APIs and services.
    1. From the main Google Cloud console navigation, choose APIs & Services > Library.
    2. Search for Cloud Functions API, and enable the service, if necessary.
    3. From the Library page, search for Cloud Build API and enable the service, if necessary.
  2. Challenge

    Create the required bucket.
    1. From the main navigation, go to Storage > Browser.
    2. Choose Create bucket.
    3. In the Name field, enter a unique name for the bucket to hold the incoming image and click Continue.
    4. From the Choose where to store your data options, choose Region and select us-east1 as the region.
    5. Leave the remaining values at their defaults, and click Create.
  3. Challenge

    Retrieve files from repo and configure.
    1. Activate the Cloud Shell.

    2. From the Cloud Shell, issue the following command to clone the repository for this course:

      git clone https://github.com/linuxacademy/content-gc-functions-deepdive
      
    3. Change directory to the lab folder: cd content-gc-functions-deepdive/cloud-functions-sms-lab

    4. Open Shell Editor by clicking the pencil icon.

    5. Navigate to the cloud-functions-sms-lab folder, and open the two files there.

    6. In the main.py file, make the necessary updates to the variables starting on line 7:

      • TWILIO_ACCOUNT_SID = "[YOUR_TWILIO_ACCOUNT_SID]"
      • TWILIO_AUTH_TOKEN = "[YOUR_TWILIO_AUTH_TOKEN]"
      • TWILIO_NUMBER = "[YOUR_TWILIO_NUMBER]"
      • TO_NUMBERS = ['ARRAY_OF_NUMBERS']
      • BUCKET = "[BUCKET_NAME]"
    7. Save the file.

  4. Challenge

    Create Cloud Function.
    1. Navigate to the Cloud Functions dashboard.
    2. Click Create function.
    3. Apply the following settings:
      • Name: acg-sms-function
      • Trigger: Cloud Storage
      • Bucket: Your bucket name
    4. Click Save and then Next.
      • Runtime: Python 3.9
      • Source code: Inline editor
    5. From the Cloud Shell Editor, select all of the main.py code and copy it.
    6. In the main.py field of the function, paste the copied code.
    7. From the Cloud Shell Editor, open requirements.txt, and copy all.
    8. In the requirements.txt field of the function, paste the copied code.
    9. In the Entry Point field, enter send_sms.
    10. Click Deploy.
  5. Challenge

    Test in Cloud Shell and Cloud Storage.
    1. In the Cloud Shell, issue the following commands:
    cd images
    ls
    gsutil cp a-cloud-guru.png gs://<BUCKET_NAME>
    
    1. Check your phone for an incoming text message.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight