Skip to content
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

Initiative Feedback Collection via Google Sheets and Webhook #452

Open
4tal opened this issue Nov 9, 2023 · 3 comments
Open

Initiative Feedback Collection via Google Sheets and Webhook #452

4tal opened this issue Nov 9, 2023 · 3 comments

Comments

@4tal
Copy link
Collaborator

4tal commented Nov 9, 2023

  1. Overview:
    A Google Spreadsheet will use Google Apps Script to provide a webhook endpoint. This endpoint will handle incoming HTTP POST requests containing feedback about a specific initiative, including its current status and various contact methods, storing them directly into the spreadsheet.

  2. Google Spreadsheet Setup:

Create a new Google Spreadsheet.
Define columns: "InitiativeName", "IsActive", "Feedback", "Telegram", "WhatsApp", "Website", "LinkedIn".
3. Google Apps Script:

Create a new script file from the Google Spreadsheet by clicking on Extensions > Apps Script.
Write a script that:
Creates a doPost(e) function to handle HTTP POST requests.
Parses and validates the request body content.
Appends valid data to the spreadsheet.
4. Script Example:

function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var postData = JSON.parse(e.postData.contents);
  
  // Extract data from the POST request body
  var initiativeName = postData.initiativeName;
  var isActive = postData.isActive ? "Yes" : "No"; // Expecting a boolean value
  var feedback = postData.feedback;
  var telegram = postData.telegram || ""; // Optional fields
  var whatsapp = postData.whatsapp || "";
  var website = postData.website || "";
  var linkedin = postData.linkedin || "";

  // Append data to the sheet
  sheet.appendRow([initiativeName, isActive, feedback, telegram, whatsapp, website, linkedin]);

  // Return a success message
  return ContentService.createTextOutput(
    JSON.stringify({"status": "success"})
  ).setMimeType(ContentService.MimeType.JSON);
}
@4tal 4tal added the devops label Nov 9, 2023
@4tal 4tal moved this to Ready For Work in Link For Israel Nov 9, 2023
@ohadschn
Copy link
Collaborator

ohadschn commented Nov 9, 2023

@4tal

  1. how is this backend and not devops? As I see it we still don't have a backend...
  2. what about creating Github issues from those GSheet records (presumably of the type Auto PR - support editing existing initiatives #428, where edit in the broad sense could also include "delete")?

@4tal
Copy link
Collaborator Author

4tal commented Nov 10, 2023

Exactly, automated PR is the next step.

@4tal
Copy link
Collaborator Author

4tal commented Nov 10, 2023

Because it function as a backend and not proper DevOps/infra area

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready For Work
Development

No branches or pull requests

2 participants