Yu-Ting ShihAndrew Shih
Menu / Language

Setup

Build the LINE Bot from scratch

This page follows the original teaching logic: prepare the data layer first, then the script layer, and finally complete LINE Webhook verification.

Original materials and learning process

Keep GAS, Sheets and Gemini as the learning path; optional Python courses do not replace these exercises.

Prerequisites

  • A LINE account that can access LINE Developers.
  • A Google account with access to Sheets, Drive, and Apps Script.
  • No Gemini API key is required for basic replies and Sheets logging. Optional AI or posting workflows need their own keys, stored in server environment variables or a secret manager.
  • A clean naming plan for folders and worksheets so maintenance stays manageable.

Step 1: Build Google Sheet as the memory layer

Historical APIKEY worksheet; never store secrets here

Historical example only: the APIKEY worksheet shown above is not recommended for storing keys. Never store secrets in Sheets; use server environment variables or a secret manager.

The teaching materials treat Google Sheet as a durable memory layer. Prepare tabs for logs, notes, uploaded files, and temporary workflow data as needed. The APIKEY tab is a historical example only, not a secret store.

Step 2: Create the Google Drive storage folder

Google Drive folder

Google Drive stores uploaded images, videos, and documents from LINE, as well as generated Docs, Slides, and report files. Keep the folder ID ready for configuration.

Step 3: Create the LINE Channel

Create a LINE Official Account and enable Messaging API in LINE Official Account Manager, then open the corresponding channel in LINE Developers Console. Store the Channel secret and Channel access token in server environment variables or a secret manager, never in Sheets. Follow the complete quickstart for configuration and verification.

Step 4: Deploy Apps Script as a web app

Webhook basics slide

Follow the original Apps Script project, doPost(e), reply_message(), deployment and authorization exercises. Keep the GAS learning architecture; signature verification and credential protection are separate security notes.

Step 5: Set and verify the Webhook

The original slides use a GAS Web App URL for the webhook. Compare deployment versions and reply tests, but do not treat Console Verify as proof of signature verification. Use a test account and synthetic data; review security before real use.

Minimum success criteria

  • Webhook verification succeeds.
  • An event reaches Apps Script when a message is sent.
  • A log or test record appears in the spreadsheet.