Module 11 / 15

Giving Your Blog a Brain

Turn your Apps Script into a Web App that Blogger can talk to.

Your Blogger site is beautiful, but it's just a "Display." To make it "Smart," we need to link it to your Apps Script workshop. Today, we'll turn your script into a Web App URL.

What You Will Learn
  • What a Web App is.
  • How to use the doGet() function.
  • How to "Deploy" your script to get a public URL.
Who Is This For?

This is for the "Web Developer" student. If you want to put a "Contact Me" form or a "Live Score" box on your Blogger page, this module is the secret key that opens that door.

Real Life Connection

Think of a Pizza Delivery App.

Your Phone (Blogger) is where you see the menu and click "Order." But the kitchen (Apps Script) is where the pizza is actually made.

The Web App URL is the delivery boy who carries the order from your phone to the kitchen and brings the pizza back!

The doGet Function

In Apps Script, doGet is a special name. It tells Google: "Whenever someone visits my script's URL, do this!"

It’s like a Welcome Mat. Every time a visitor (Blogger) steps on the mat, the script wakes up and says "How can I help you?"

How to Connect Them
1. Create a doGet function in your script.
⬇️
2. Click Deploy > New Deployment.
⬇️
3. Select Web App and set access to Anyone.
⬇️
4. Copy the Web App URL.
The Web App Script

To talk back to a website, we have to return a special type of text called TextOutput. It’s like the "Receipt" we give back to Blogger.

function doGet() {
  // 1. Create the message
  const message = "Hello! Your Blogger site is now connected.";

  // 2. Send it back in a way websites understand
  return ContentService.createTextOutput(message);
}
The "Bridge" Script

Copy this into your Apps Script editor, then click the blue Deploy button at the top right.

function doGet() { return ContentService .createTextOutput("Blogger Bridge: ONLINE"); }
The Magic URL

Once you deploy, you'll get a URL that looks like this:
https://script.google.com/macros/s/.../exec

If you paste that URL into your browser, you will see a white screen that says: Blogger Bridge: ONLINE. This means any website in the world can now hear your script!

Why is my URL not working?
Click to fix deployment issues

1. Access Denied: When deploying, you MUST set "Who has access" to Anyone. If you set it to "Only me," Blogger won't be allowed to talk to the script.

2. New Deployment: Every time you change your code, you must click Deploy > Manage Deployments > Edit and choose "New Version." Otherwise, the URL will still use your old, broken code!

3. Spelling: It must be exactly doGet (lowercase 'd', capital 'G'). If you type doget, it won't work.

The "Status Checker" Challenge

Change the message in the code to "System: Operational - [Your Name]". Re-deploy the script and refresh the URL in your browser. Can you see your name on the screen?

Who Else Uses This?

Websites like Wikipedia use this! They have a "Base" (the text) and a "Brain" (the database). Every time you search for a word, the "Base" talks to the "Brain" using a URL, just like you are doing now!

Module Summary

You’ve just built a public API! That sounds fancy, but it just means you've created a way for the whole internet to talk to your code. You are ready to build real-world projects on your blog.

Status: Bridge Builder 🌉 | Level: Web Developer 🌐

Type NEXT to unlock the next module 🚀