Skip to content

Conversation

@capcom6
Copy link
Member

@capcom6 capcom6 commented Oct 12, 2025

Summary by CodeRabbit

  • New Features

    • Added an HTTP endpoint to receive SMS webhooks and log incoming messages into a Google Sheet with payload validation, error handling, and JSON success/error responses.
  • Documentation

    • Added a comprehensive README covering project overview, prerequisites, setup/deployment, webhook configuration, usage, payload structure, troubleshooting, and contribution/licensing.

@coderabbitai
Copy link

coderabbitai bot commented Oct 12, 2025

Walkthrough

Adds a README documenting an Example Google Sheets Integration and a Google Apps Script doPost(e) webhook endpoint that ingests JSON payloads from sms-gate.app and appends selected fields to a Google Sheet named "Messages", returning JSON success/error responses and logging failures.

Changes

Cohort / File(s) Summary of Changes
Documentation
README.md
Adds project overview, prerequisites, installation/deployment steps, webhook configuration for sms-gate.app, usage instructions, webhook payload schema, troubleshooting, and contribution/licensing details.
Apps Script Webhook
code.gs
Adds doPost(e) to parse JSON body from e.postData.contents, validate/access the "Messages" sheet, require payload and phoneNumber, extract deviceId, messageId, message, phoneNumber, receivedAt (or use current time), append a row `[receivedAt

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor SG as SMS-Gate Webhook
  participant WA as Apps Script Web App (doPost)
  participant GS as Google Sheet "Messages"

  SG->>WA: HTTP POST JSON { deviceId, payload{messageId, message, phoneNumber, receivedAt} }
  WA->>WA: Parse request body, validate payload and sheet
  alt Sheet exists and payload valid
    WA->>GS: Append row [receivedAt|now, phoneNumber, message, deviceId, messageId]
    GS-->>WA: Append OK
    WA-->>SG: 200 JSON { status: "ok" }
  else Error (missing sheet/payload/append failure)
    WA->>WA: Logger.log(error)
    WA-->>SG: 400/500 JSON { status: "error", message }
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title "[init] first implementation" is vague and does not clearly describe the specific functionality added, such as the Google Apps Script endpoint for SMS webhooks and the example README that documents the integration. Consider renaming the pull request to something more descriptive, for example "Initial Google Sheets SMS webhook integration with README", so that the title clearly reflects the main changes introduced in this pull request.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch init/first-implementation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (5)
code.gs (2)

14-25: Validate required webhook fields.

The destructuring assigns undefined to missing fields without validation. This could result in incomplete or invalid data being written to the sheet.

Apply this diff to validate required fields:

     // Extract fields from the webhook payload according to sms-gate.app docs
     const {
       deviceId,
       payload,
     } = body;
+
+    if (!payload) {
+      throw new Error("Missing required field: payload");
+    }

     const {
       messageId,
       message,
       phoneNumber,
       receivedAt,
     } = payload;
+
+    if (!message || !phoneNumber) {
+      throw new Error("Missing required fields: message or phoneNumber");
+    }

1-48: Consider adding structured logging for production monitoring.

Logger.log is basic and may not provide sufficient observability for production webhooks. Consider whether you need more robust logging.

For production deployments, consider:

  1. Using Google Cloud Logging via console.log() in Apps Script (automatically integrates with Cloud Logging)
  2. Adding request IDs to track individual webhook calls
  3. Logging successful requests (not just errors) for audit trails
  4. Implementing monitoring/alerting for webhook failures
README.md (3)

67-67: Standardize product name reference.

For consistency, use "SMS-Gate" or "sms-gate.app" instead of "SMSGate app".

Apply this diff:

-- An SMSGate app on your phone
+- An SMS-Gate app on your phone

119-119: Standardize product name reference.

Use consistent naming ("SMS-Gate" or "sms-gate.app") throughout the documentation.

Apply this diff:

-The script expects webhook payloads from SMSGate in the following format:
+The script expects webhook payloads from SMS-Gate in the following format:

94-96: Add security warning about "Anyone" access.

Setting "Who has access" to "Anyone" means the webhook URL is publicly accessible without authentication. This should be highlighted as a security consideration.

Apply this diff to add a security note:

    - Under "Execute as", select "Me (your account)"
-   - Under "Who has access", select "Anyone"
+   - Under "Who has access", select "Anyone" (Note: This makes the webhook publicly accessible. See the Troubleshooting section for security considerations.)
    - Click "Deploy"

Additionally, consider adding a security section to the Troubleshooting area that mentions webhook authentication options.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f7176f and e793ba3.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • code.gs (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md

78-78: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


100-100: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

@capcom6 capcom6 force-pushed the init/first-implementation branch from cdfd473 to 26f4451 Compare October 16, 2025 06:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
README.md (3)

78-80: Specify a language for the fenced code block (markdownlint MD040).

Apply this diff:

-     ```
+     ```text
      Timestamp | From | Message | DeviceID | MessageID
      ```

Based on static analysis hints.


100-102: Specify a language for the fenced code block (markdownlint MD040).

Apply this diff:

-     ```
+     ```text
      https://script.google.com/macros/s/AKfycbx.../exec
      ```

Based on static analysis hints.


43-43: Correct product name for consistency.

Use “sms-gate.app” (or “SMS-Gate”) consistently.

Apply this diff:

-This project provides a Google Apps Script integration for SMSGate that automatically logs incoming SMS messages to a Google Sheet. When SMS messages are received through the app, a webhook is sent to this script which parses the message data and appends it to your Google Sheet with the following columns:
+This project provides a Google Apps Script integration for sms-gate.app that automatically logs incoming SMS messages to a Google Sheet. When SMS messages are received through the app, a webhook is sent to this script which parses the message data and appends it to your Google Sheet with the following columns:

Based on learnings from previous review.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdfd473 and 26f4451.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • code.gs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • code.gs
🧰 Additional context used
🪛 LanguageTool
README.md

[grammar] ~5-~5: There might be a mistake here.
Context: ...url] [![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url]...

(QB_NEW_EN)


[grammar] ~28-~28: There might be a mistake here.
Context: ... - 🌐 About The Project - [🛠️ ...

(QB_NEW_EN)


[grammar] ~28-~28: There might be a mistake here.
Context: ... OF CONTENTS --> - 🌐 About The Project - 🛠️ Built With - [🚀 Get...

(QB_NEW_EN)


[grammar] ~29-~29: There might be a mistake here.
Context: ...#-about-the-project) - 🛠️ Built With - 🚀 Getting Started ...

(QB_NEW_EN)


[grammar] ~30-~30: There might be a mistake here.
Context: ...th](#️-built-with) - 🚀 Getting Started - 📋 Prerequisites - [...

(QB_NEW_EN)


[grammar] ~31-~31: There might be a mistake here.
Context: ...#-getting-started) - 📋 Prerequisites - ⚙️ Installation - [💻 ...

(QB_NEW_EN)


[grammar] ~32-~32: There might be a mistake here.
Context: ...s](#-prerequisites) - ⚙️ Installation - 💻 Usage - [📨 Webhook Paylo...

(QB_NEW_EN)


[grammar] ~33-~33: There might be a mistake here.
Context: ...stallation](#️-installation) - 💻 Usage - [📨 Webhook Payload Structure](#-webhook-...

(QB_NEW_EN)


[grammar] ~34-~34: There might be a mistake here.
Context: ...usage) - 📨 Webhook Payload Structure - 🔧 Troubleshooting -...

(QB_NEW_EN)


[grammar] ~35-~35: There might be a mistake here.
Context: ...yload-structure) - 🔧 Troubleshooting - 🤝 Contributing - [📜 L...

(QB_NEW_EN)


[grammar] ~37-~37: There might be a mistake here.
Context: ...tributing](#-contributing) - 📜 License ## 🌐 About The Project This project provi...

(QB_NEW_EN)


[grammar] ~41-~41: There might be a mistake here.
Context: ... THE PROJECT --> ## 🌐 About The Project This project provides a Google Apps Scri...

(QB_NEW_EN)


[grammar] ~45-~45: There might be a mistake here.
Context: ...mestamp**: When the message was received - From: The phone number that sent the m...

(QB_NEW_EN)


[grammar] ~46-~46: There might be a mistake here.
Context: ...: The phone number that sent the message - Message: The SMS message content - **D...

(QB_NEW_EN)


[grammar] ~47-~47: There might be a mistake here.
Context: ... - Message: The SMS message content - DeviceID: The device ID - *MessageID...

(QB_NEW_EN)


[grammar] ~48-~48: There might be a mistake here.
Context: ...ge content - DeviceID: The device ID - MessageID: The unique message ID ### ...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...he unique message ID ### 🛠️ Built With - [Google Apps Script](https://developers.g...

(QB_NEW_EN)


[grammar] ~53-~53: There might be a mistake here.
Context: ...## 🛠️ Built With - Google Apps Script - [Google Sheets](https://sheets.google.com...

(QB_NEW_EN)


[grammar] ~59-~59: There might be a mistake here.
Context: ...ETTING STARTED --> ## 🚀 Getting Started Follow these instructions to set up the ...

(QB_NEW_EN)


[grammar] ~63-~63: There might be a mistake here.
Context: ...heets integration. ### 📋 Prerequisites - A Google account - Access to Google Shee...

(QB_NEW_EN)


[grammar] ~65-~65: There might be a mistake here.
Context: ...### 📋 Prerequisites - A Google account - Access to Google Sheets - An SMSGate app...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...Google account - Access to Google Sheets - An SMSGate app on your phone ### ⚙️ Ins...

(QB_NEW_EN)


[grammar] ~86-~86: There might be a mistake here.
Context: ...tor in a new tab 3. Deploy the Script - Remove any existing code in the editor ...

(QB_NEW_EN)


[grammar] ~91-~91: There might be a mistake here.
Context: ...n (floppy disk) 4. Deploy the Web App - Click on "Deploy" > "New deployment" ...

(QB_NEW_EN)


[grammar] ~115-~115: There might be a mistake here.
Context: .../p> ## 💻 Usage ### 📨 Webhook Payload Structure The script...

(QB_NEW_EN)


[grammar] ~117-~117: There might be a mistake here.
Context: ... Usage ### 📨 Webhook Payload Structure The script expects webhook payloads from...

(QB_NEW_EN)


[grammar] ~133-~133: There might be a mistake here.
Context: ...0:00Z" } } ``` ### 🔧 Troubleshooting - Sheet not found: Ensure your sheet is ...

(QB_NEW_EN)


[grammar] ~143-~143: There might be a mistake here.
Context: ... ## 🤝 Contributing Contributions are what make the open sou...

(QB_NEW_EN)


[grammar] ~145-~145: Use a hyphen to join words.
Context: ...ng Contributions are what make the open source community such an amazing place t...

(QB_NEW_EN_HYPHEN)


[style] ~145-~145: Consider using a more formal and expressive alternative to ‘amazing’.
Context: ...hat make the open source community such an amazing place to learn, inspire, and create. An...

(AWESOME)


[style] ~147-~147: The wording of this phrase can be improved.
Context: ...*. If you have a suggestion that would make this better, please fork the repo and create a pull...

(MAKE_STYLE_BETTER)


[grammar] ~159-~159: There might be a mistake here.
Context: ...

## 📜 License Distributed under the Apache License 2.0...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.18.1)
README.md

78-78: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


100-100: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (1)
README.md (1)

88-88: Confirm code.gs reference: code.gs exists at the repository root, so the README link is valid.

@capcom6 capcom6 merged commit 114f8a4 into master Oct 16, 2025
1 check passed
@capcom6 capcom6 deleted the init/first-implementation branch October 16, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant