-
Notifications
You must be signed in to change notification settings - Fork 0
[init] first implementation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a README documenting an Example Google Sheets Integration and a Google Apps Script Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
undefinedto 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.logis basic and may not provide sufficient observability for production webhooks. Consider whether you need more robust logging.For production deployments, consider:
- Using Google Cloud Logging via
console.log()in Apps Script (automatically integrates with Cloud Logging)- Adding request IDs to track individual webhook calls
- Logging successful requests (not just errors) for audit trails
- 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
📒 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)
cdfd473 to
26f4451
Compare
There was a problem hiding this 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
📒 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: ...
(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.gsexists at the repository root, so the README link is valid.
Summary by CodeRabbit
New Features
Documentation