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

feat: Added Contact Form on Homepage with Google Sheet API #40

Merged
merged 4 commits into from
Jun 9, 2023

Conversation

luckyklyist
Copy link
Contributor

@luckyklyist luckyklyist commented Jun 6, 2023

What does this PR do?

Fixes #25
/claim #25

  1. Utilized the google-spreadsheet npm package (version 3.3.0) to handle user form submissions.
  2. Integrated Next.js' pages/api functionality to create an API route for form submission.
  3. Extracted the form data from the request body, including fields such as Name, Email, and Message.
  4. Loaded the Google Sheets document using the provided SPREAD_SHEET_ID environment variable.
  5. Implemented authentication using the CLIENT_EMAIL and PRIVATE_KEY obtained from the Google Console.
  6. Appended the form data as a new row in the Google Sheets document.
  7. Handled success and error responses accordingly.
  8. Implemented redirection to the home page after successful form submission.

image

Screencast.from.06-06-2023.05.07.49.PM.webm
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

To set up and use this feature, the following steps are required:

  1. Obtain the CLIENT_EMAIL and PRIVATE_KEY from the Google Console.
  2. Set the SPREAD_SHEET_ID environment variable to your specific Google Sheets document ID.
  3. Make sure the Google Sheets document has a header row with columns for Name, Email, and Message fields.
  4. Provide the necessary permissions to the CLIENT_EMAIL for accessing the Google Sheets document.

I would appreciate it if you could review my PR and provide any feedback or suggestions for improvement. Currently, I am working on the Vercel API and facing an error in the redirection part in the hompage. Your guidance in resolving this issue would be greatly appreciated.

Updated video

Screencast.from.06-09-2023.01.26.48.AM.mp4

@vercel
Copy link

vercel bot commented Jun 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
piyushgargdev-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2023 0:41am

@piyushgarg-dev piyushgarg-dev added the Amazing This Indicates that the issue/PR is amazing and worth checking label Jun 7, 2023
@piyushgarg-dev
Copy link
Owner

Amazing PR + Description ✨

@piyushgarg-dev
Copy link
Owner

There are multiple commits in this PR.
Please remove commit 06b079d

@luckyklyist
Copy link
Contributor Author

There are multiple commits in this PR. Please remove commit 06b079d

sure

@luckyklyist luckyklyist changed the title Contact form feat : Contact form Jun 7, 2023
@piyushgarg-dev
Copy link
Owner

piyushgarg-dev commented Jun 7, 2023

@luckyklyist
Amazing, Please add the env variables that need to be added in .env.example file and then we are ready to merge.

@piyushgarg-dev piyushgarg-dev changed the title feat : Contact form feat: Added Contact Form on Homepage with Google Sheet API Jun 8, 2023
@vercel
Copy link

vercel bot commented Jun 8, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @piyushgarg-dev on Vercel.

@piyushgarg-dev first needs to authorize it.

@piyushgarg-dev piyushgarg-dev merged commit 0d61b66 into piyushgarg-dev:main Jun 9, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Amazing This Indicates that the issue/PR is amazing and worth checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a Contact Me Form on HomePage
2 participants