์นํ ์ฐ๋ํ๊ธฐ
์นํ ์ฐ๋์ ๊ธฐ๋ณธ
-
์นํ ์ข ๋ฅ
- Submit: ์๋ต์ด ์ ์ถ๋ ๊ฒฝ์ฐ, ์๋ฆผ์ ๋ณด๋ด์.
- Reject: ์๋ต์ด ์ ์ถ๋์ง ๋ชปํ๊ณ ์ค๊ฐ์ ํ๋ฝ๋ ๊ฒฝ์ฐ (ํ๋ฝ ํ๋๋ก ์ด์ด์ง ๊ฒฝ์ฐ), ์๋ฆผ์ ๋ณด๋ด์.
-
์นํ ์ด๋ฆ: ์นํ ์ ์ด๋ฆ์ด์์.
-
์นํ ์ฃผ์: ์๋ํํฐ ํด์์ ์นํ ์ฐ๋์ ์ํด ์ ๊ณตํ๋ URL์ด์์.
-
์์ฒญ ์ข ๋ฅ: https ์์ฒญ์ ์ข ๋ฅ๋ฅผ Post ์ Get ์ค์์ ์ ํํ ์ ์์ด์.
-
์ปค์คํ Header: Key-Value๋ฅผ ์์ ๋กญ๊ฒ ์ปค์คํฐ๋ง์ด์ง ํ ์ ์์ด์.
- Header Name: Discord, Slack ๋ฑ์์๋ ๊ธฐ๋ณธ์ ์ผ๋ก 'Content-Type'์ ์ฌ์ฉํด์.
- Value: Discord, Slack ๋ฑ์์๋ ๊ธฐ๋ณธ์ ์ผ๋ก 'application/json'์ ์ฌ์ฉํด์.
-
Body ์ค์ :
- ์ปค์คํ Body: Body ํ๋ฆฌ์ ๊ฐ์ ์ด์ฉํด ์นํ ์๋ฆผ์ ๋ด์ฉ์ ์ ๋ ฅํ ์ ์์ด์.
- Body ํ๋ฆฌ์
: ๊ธฐ๋ณธ์ ์ผ๋ก
"":"{{res:์๋ต๊ฐ}}"
์ ํ์์ผ๋ก, ๋ฐ์ดํ ์์ ๊ฐ์ ๋ณต์ฌํด ์ปค์คํ Body์ ๋ถ์ฌ๋ฃ์ด ์ด์ฉํ ์ ์์ด์.- ๋ฌธํญ: ์ด๋ค ๋ฌธํญ์ ์๋ต์ธ์ง ํ์ธํ ์ ์์ด์.
- โํ๋ ํ๋โ๋ฅผ ์ถ๊ฐํ ๊ฒฝ์ฐ, ๋งจ ์๋์ ์๊ธฐ๋ โํ๋ ํ๋โ์ ํ๋ฆฌ์ ์ ๋ณต์ฌํ ์ ์์ด์.
- projectKey: ์ด๋ค ํ๋ก์ ํธ์ธ์ง project Key๋ฅผ ํ์ธํ ์ ์์ด์.
- customerKey: ์ด๋ค ์๋ต์์ธ์ง customer Key๋ฅผ ํ์ธํ ์ ์์ด์.
- ์ด๋ URL์ ํ๋ ํ๋์ ๋ง์ฐฌ๊ฐ์ง๋ก customerKey=value ๋ฅผ ์
๋ ฅํด์ฃผ์ด์ผ ํด์. ex)
https://walla.my/v/~~~?source=Instagram&
customerKey=Minsu
- ์ด๋ URL์ ํ๋ ํ๋์ ๋ง์ฐฌ๊ฐ์ง๋ก customerKey=value ๋ฅผ ์
๋ ฅํด์ฃผ์ด์ผ ํด์. ex)
- responseKey: ์ด๋ค ์๋ต์ธ์ง response Key๋ฅผ ํ์ธํ ์ ์์ด์.
- ๋ฌธํญ: ์ด๋ค ๋ฌธํญ์ ์๋ต์ธ์ง ํ์ธํ ์ ์์ด์.
- ๋ง์ฝ ์๋ต ๋ด์ฉ๊ณผ ํ๋ ํ๋์ ์ข
๋ฅ๋ฅผ ์๋ฆผ ๋ฐ๊ธฐ ์ํด
https://walla.my/v/
fLptDL9bbvlxRvWRTNud?source=Instagram&customerKey=Minsu ๋ผ๋ ์ค๋ฌธ URL์ ๊ณต์ ํ๊ณ , ์๋์ ๊ฐ์ด Body๋ฅผ ์ค์ ํ๋ค๋ฉด
{
"content": "{{projectKey}} ์ค๋ฌธ์ ์๋ต์ด ๋์ฐฉํ์ต๋๋ค! ์๋ต์์ ์์ผ์ {{res:2865092957}}์
๋๋ค. ์ด ์๋ต์ CustomerKey๋ {{customerKey}}์ด๊ณ , ResponseKey๋ {{responseKey}}์
๋๋ค. ํ๋ ํ๋ {{hidden:1495742778}}๋ฅผ ํตํด ๊ธฐ๋ก๋ ์๋ต์
๋๋ค."
}
์ด๋ฌํ ์นํ ์๋ฆผ์ ๋ฐ์ ์ ์์ด์.
Discord ์ฐ๋ํ๊ธฐ
1. ์๋ฆผ์ ๋ฐ๊ณ ์ ํ๋ Discord ์๋ฒ์ '์ฑ๋ ํธ์ง' ์ค์ ์ ๋ค์ด๊ฐ์ฃผ์ธ์.
2. '์ฐ๋' ํญ์ '์นํํฌ'๋ฅผ ํด๋ฆญํด์ฃผ์ธ์.
3. '์น ํํฌ URL ๋ณต์ฌ'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
4. ์๋ผ์ '์ฐ๋ํ๊ธฐ' ํญ์์ '์นํ ๊ด๋ฆฌ' ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์.
5. Discord์์ ๋ณต์ฌํ URL์ ๋ถ์ฌ๋ฃ๊ณ , '์นํ ์ถ๊ฐ' ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์.
6. ์ปค์คํ
ํค๋์ Header Name
๊ฐ์ Content-Type
์ผ๋ก, Value
๊ฐ์ application/json
์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์.
7. Body ์ค์ ์ ํ์ฑํํ ํ, ์๋์ Body ํ๋ฆฌ์ ์ ์ฐธ๊ณ ํด ์์ ๋กญ๊ฒ ๋์ค์ฝ๋๋ก ๋ฐ๊ณ ์ ํ๋ ๋ด์ฉ์ ์์ฑํด์ฃผ์ธ์.
-
์๋์ ํ์์ ๋ฐ๋ผ, ํฐ๋ฐ์ดํ ์ฌ์ด์ ์ํ๋ ๋ด์ฉ์ ์์ฑํด์ฃผ์ธ์.
-
์๋ต ๋ด์ฉ์ ๋ฐ๊ณ ์ถ์ ๊ฒฝ์ฐ์๋ ํ๋ฆฌ์ ์
{{res:~~}}
๋ฅผ ๋ถ์ฌ๋ฃ์ด์ฃผ์ธ์. -
ํ๋ ํ๋๋ฅผ ์ค์ ํ ๊ฒฝ์ฐ์๋ ํ๋ ํ๋ ๋ด์ฉ๋ ์๋ฆผ์ผ๋ก ๋ฐ์ ์ ์์ด์.
8. ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฅํ ํ, '์นํ ์ค์ '์์ ํ์ฑํ ํด์ฃผ์ธ์.
9. ์๋ต์ด ๋์ฐฉํ๋ฉด ๋์ค์ฝ๋๋ก ์๋ฆผ์ ๋ฐ์ ์ ์์ด์.
SLACK ์ฐ๋ํ๊ธฐ
1. https://api.slack.com/start/quickstart (opens in a new tab) ์์ 'Go to Your Apps'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
2. 'Create an App'์ ๋๋ฌ์ฃผ์ธ์.
3. 'From scratch'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
4. ์นํ ์ ์ด๋ฆ์ ์ ๋ ฅํ๊ณ ์๋ฆผ์ ๋ฐ์ Slack ์ํฌ์คํ์ด์ค๋ฅผ ์ ํํด์ฃผ์ธ์.
5. 'Incoming Webhooks'๋ฅผ ํด๋ฆญํด์ฃผ์ธ์.
6. ์นํ ์ฌ์ฉ์ ํ์ฑํํด์ฃผ์ธ์.
7. 'Add New Webhook to Workspace'๋ฅผ ํด๋ฆญํด์ฃผ์ธ์.
8. ์๋ฆผ์ ๋ฐ์ ์ฑ๋์ ์ ํํด์ฃผ์ธ์.
9. ์์ฑ๋ ์นํ URL์ ๋ณต์ฌํด์ฃผ์ธ์.
10. ์๋ผ์ '์ฐ๋ํ๊ธฐ' ํญ์์ '์นํ ๊ด๋ฆฌ' ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์.
11. Slack์์ ๋ณต์ฌํ URL์ ๋ถ์ฌ๋ฃ๊ณ , '์นํ ์ถ๊ฐ' ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์.
12. ์ปค์คํ
ํค๋์ Header Name
๊ฐ์ Content-Type
์ผ๋ก, Value
๊ฐ์ application/json
์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์.
13. Body ์ค์ ์ ํ์ฑํํ ํ, ์๋์ Body ํ๋ฆฌ์ ์ ์ฐธ๊ณ ํด ์์ ๋กญ๊ฒ SLACK์ผ๋ก ๋ฐ๊ณ ์ ํ๋ ๋ด์ฉ์ ์์ฑํด์ฃผ์ธ์.
- ์๋์ ํ์์ ๋ฐ๋ผ, ํฐ๋ฐ์ดํ ์ฌ์ด์ ์ํ๋ ๋ด์ฉ์ ์์ฑํด์ฃผ์ธ์.
{
"text": "์ด ๋ถ๋ถ์ ์์ ๋กญ๊ฒ ๋ด์ฉ์ ์์ฑํด์ฃผ์ธ์."
}
-
์๋ต ๋ด์ฉ์ ๋ฐ๊ณ ์ถ์ ๊ฒฝ์ฐ์๋ ํ๋ฆฌ์ ์
{{res:~~}}
๋ฅผ ๋ถ์ฌ๋ฃ์ด์ฃผ์ธ์. -
ํ๋ ํ๋๋ฅผ ์ค์ ํ ๊ฒฝ์ฐ์๋ ํ๋ ํ๋ ๋ด์ฉ๋ ์๋ฆผ์ผ๋ก ๋ฐ์ ์ ์์ด์.
14. ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฅํ ํ, '์นํ ์ค์ '์์ ํ์ฑํ ํด์ฃผ์ธ์.
15. 'Install App' ํญ์์ 'Reinstall to Workspace'๋ฅผ ๋๋ฌ ๋ค์ ์นํ ์ ์ค์นํด์ฃผ์ธ์.
16. ์๋ฆผ์ ๋ฐ์ ์ฑ๋์ ์ ํํด์ฃผ์ธ์.
17. ์๋ต์ด ๋์ฐฉํ๋ฉด SLACK์ผ๋ก ์๋ฆผ์ ๋ฐ์ ์ ์์ด์.
์ด๋ฉ์ผ ์ฐ๋ํ๊ธฐ
1. https://script.google.com/ (opens in a new tab) ์ ์ ์ํด '์ ํ๋ก์ ํธ'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
2. ๊ธฐ๋ณธ ๋ด์ฉ์ ๋ชจ๋ ์ง์ด ํ, ์๋์ ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ์ด์ฃผ์ธ์.
-
์ฝ๋ ์ค
"------@------.---"
๋ถ๋ถ์๋ ๋ฐ์ดํ ์ฌ์ด์ ์๋ฆผ์ ๋ฐ์ ์ด๋ฉ์ผ์ ์ ์ด์ฃผ์ธ์. -
ex)
"minsu@walla.my, yeonghee@walla.my"
-
์ฝ๋ ์ค
<${FORM_TITLE}> ------------
๋ถ๋ถ์๋ ๋ฉ์ผ์ ์ ๋ชฉ์ ์ ๋ ฅํด ์ฃผ์ธ์. -
ex)
<${FORM_TITLE}> ์ค๋ฌธ์ ์ ์ถ๋ ์๋ต
function doPost(e) {
// Parsing the POST data to get the required data
var data = JSON.parse(e.postData.contents);
var formAnswers = data.form_answers;
var submittedAt = new Date(data.form_response.submitted_at);
var formattedDate = formatDate(submittedAt);
var FORM_TITLE= data.form_definition.title;
var PROJECT_KEY= data.form_definition.id;
// Building email content with enhanced styling
var emailBody = `<!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <meta charset="utf-8"/> <meta content="width=device-width" name="viewport"/> <meta content="IE=edge" http-equiv="X-UA-Compatible"/> <meta name="x-apple-disable-message-reformatting"/> <meta content="telephone=no,address=no,email=no,date=no,url=no" name="format-detection"/> <title>Checkout</title> <link href="https://fonts.googleapis.com/css?family=Inter:600" rel="stylesheet" type="text/css"><link href="https://fonts.googleapis.com/css?family=Inter:400" rel="stylesheet" type="text/css"> <!--[if mso]> <style> * { font-family: sans-serif !important; } </style> <![endif]--> <!--[if !mso]><!--> <!-- <![endif]--> <style> html { margin: 0 !important; padding: 0 !important; } * { -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; } td { vertical-align: top; mso-table-lspace: 0pt !important; mso-table-rspace: 0pt !important; } a { text-decoration: none; } img { -ms-interpolation-mode:bicubic; } @media only screen and (min-device-width: 320px) and (max-device-width: 374px) { u ~ div .email-container { min-width: 320px !important; } } @media only screen and (min-device-width: 375px) and (max-device-width: 413px) { u ~ div .email-container { min-width: 375px !important; } } @media only screen and (min-device-width: 414px) { u ~ div .email-container { min-width: 414px !important; } } </style> <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG/> <o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml> <![endif]--> <style> @media only screen and (max-device-width: 599px), only screen and (max-width: 599px) { .eh { height:auto !important; } .desktop { display: none !important; height: 0 !important; margin: 0 !important; max-height: 0 !important; overflow: hidden !important; padding: 0 !important; visibility: hidden !important; width: 0 !important; } .mobile { display: block !important; width: auto !important; height: auto !important; float: none !important; } .email-container { width: 100% !important; margin: auto !important; } .stack-column, .stack-column-center { display: block !important; width: 100% !important; max-width: 100% !important; direction: ltr !important; } .wid-auto { width:auto !important; } .table-w-full-mobile { width: 100%; } .mobile-center { text-align: center; } .mobile-center > table { display: inline-block; vertical-align: inherit; } .mobile-left { text-align: left; } .mobile-left > table { display: inline-block; vertical-align: inherit; } .mobile-right { text-align: right; } .mobile-right > table { display: inline-block; vertical-align: inherit; } } </style></head> <body width="100%" style="background-color:#f0f0f0;margin:0;padding:0!important;mso-line-height-rule:exactly;"> <div style="background-color:#f0f0f0"> <!--[if gte mso 9]> <v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t"> <v:fill type="tile" color="#f0f0f0"/></v:background> <![endif]--> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" align="center"><table bgcolor="#ffffff" style="margin:0 auto;" align="center" id="brick_container" cellspacing="0" cellpadding="0" border="0" width="600" class="email-container"><tr> <td width="600"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="600" style="background-color:#ffffff; " bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="600"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="552" style="height:88px; background-color:#ffffff; padding-left:24px; padding-right:24px;" bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="8" style="height:8px; min-height:8px; line-height:8px;"></td></tr> <tr><td ><table cellspacing="0" cellpadding="0" border="0"><tr><td width="120" ><img src="https://plugin.markaimg.com/public/43a815fe/bPMY4vgBZFROX7CsM8YKvooE7Gafev.png" width="120" border="0" style="min-width:120px; width:120px; height: auto; display: block;"></td></tr></table></td></tr> <tr><td height="8" style="height:8px; min-height:8px; line-height:8px;"></td></tr></table></td></tr></table></td></tr><tr> <td width="600"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="552" style="background-color:#ffffff; padding-left:24px; padding-right:24px;" bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr> <tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td ><div style="line-height:36px;text-align:left;"><span style="color:#101828;font-weight:600;font-family:Inter,Arial,sans-serif;font-size:28px;line-height:36px;text-align:left;">New response is submitted.</span></div></td></tr><tr><td height="8" style="height:8px; min-height:8px; line-height:8px;"></td></tr><tr><td ><div style="line-height:24px;text-align:left;"><span style="color:#667085;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:left;">A new response was submitted to your project โ${FORM_TITLE}โ.</span></div></td></tr></table></td></tr> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr></table></td></tr></table></td></tr><tr> <td width="100%"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="100%" style="background-color:#ffffff; padding-left:24px; padding-right:24px;" bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr> <tr> <td width="100%"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="552" align="center" style="background-color:#ffffff; " bgcolor="#ffffff" > <table class="table-w-full-mobile" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" width="49%" class="stack-column-center"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="right" style="background-color:#ffffff; " bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="24" align="right"><img src="https://plugin.markaimg.com/public/43a815fe/daIuervM7Qtcl2wyGNMCY87fXUdxzA.png" width="24" border="0" style="min-width:24px; width:24px; height: auto; display: block;"></td><td style="width:8px; min-width:8px;" width="8"></td> <td > <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="center" style="background-color:#ffffff; " bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td align="center"><div style="line-height:20px;text-align:left;"><span style="color:#363a57;font-weight:700;font-family:Arial,Arial,sans-serif;font-size:15px;line-height:20px;text-align:left;">Project </span></div></td></tr><tr><td height="4" style="height:4px; min-height:4px; line-height:4px;"></td></tr><tr><td align="center"><div style="line-height:24px;text-align:left;"><span style="color:#101828;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:left;">${FORM_TITLE}</span></div></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td><td class="stack-column-center" height="16" style="width:16px; min-width:16px; height:16px; min-height:16px;" width="16"></td> <td align="center" width="49%" class="stack-column-center"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="right" style="background-color:#ffffff; " bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="24" align="right"><img src="https://plugin.markaimg.com/public/43a815fe/o9Gf4q7jZW8ve9moQojP9v0h91Amrv.png" width="24" border="0" style="min-width:24px; width:24px; height: auto; display: block;"></td><td style="width:8px; min-width:8px;" width="8"></td> <td > <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="center" style="background-color:#ffffff; " bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td align="center"><div style="line-height:20px;text-align:left;"><span style="color:#363a57;font-weight:700;font-family:Arial,Arial,sans-serif;font-size:15px;line-height:20px;text-align:left;">Recent timestamp</span></div></td></tr><tr><td height="4" style="height:4px; min-height:4px; line-height:4px;"></td></tr><tr><td align="center"><div style="line-height:20px;text-align:left;"><span style="color:#363a57;font-family:Arial,Arial,sans-serif;font-size:15px;line-height:20px;text-align:left;">${formattedDate}</span></div></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr><tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr>`
formAnswers.forEach(function(field, index) {
var question = field.label;
var answer = getAnswerString(field);
const reponseSection = `<tr><td width="100%" align="center" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="16" style="height:16px; min-height:16px; line-height:16px;"></td></tr> <tr> <td > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td ><div style="line-height:28px;text-align:left;"><span style="color:#101828;font-weight:600;font-family:Inter,Arial,sans-serif;font-size:20px;line-height:28px;text-align:left;">${question}</span></div></td></tr></table></td></tr></table></td></tr> <tr><td height="16" style="height:16px; min-height:16px; line-height:16px;"></td></tr></table></td></tr><tr> <td width="100%"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="100%" style="background-color:#f4f5f6; border-radius:8px; padding-left:12px; padding-right:12px;" bgcolor="#f4f5f6" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="16" style="height:16px; min-height:16px; line-height:16px;"></td></tr> <tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td ><div style="line-height:24px;text-align:left;"><span style="color:#667085;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:left;">${answer}</span></div></td></tr></table></td></tr></table></td></tr> <tr><td height="16" style="height:16px; min-height:16px; line-height:16px;"></td></tr></table></td></tr></table></td></tr></table></td></tr>`
// Adding to email body
emailBody += reponseSection
});
emailBody +=`<tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr></table></td></tr></table></td></tr><tr> <td width="600"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="552" align="center" style="vertical-align: middle; background-color:#ffffff; padding-left:24px; padding-right:24px;" bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr> <tr> <td style="vertical-align: middle;" width="100%"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="100%" align="center" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="560" align="center" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td align="center"><div style="line-height:24px;text-align:center;"><span style="color:#667085;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:center;">Check out the most recent response!</span></div></td></tr></table></td></tr></table></td></tr><tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr><tr><td align="center"><table cellspacing="0" cellpadding="0" border="0"><tr><td align="center"> <div> <!--[if mso]> <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://app.walla.my" style="height:50px;v-text-anchor:middle;width:160px;" fillcolor="#000000" stroke="f" arcsize="16%"> <w:anchorlock/> <center style="white-space:nowrap;display:inline-block;text-align:center;color:#ffffff;font-weight:600;font-family:Inter,Arial,sans-serif;font-size:18px;">Take me</center></v:roundrect> <![endif]--> <a href="https://app.walla.my" style="white-space:nowrap;background-color:#000000;border-radius:8px; display:inline-block;text-align:center;color:#ffffff;font-weight:600;font-family:Inter,Arial,sans-serif;font-size:18px;line-height:50px;width:160px; -webkit-text-size-adjust:none;mso-hide:all;">Take me</a></div></td></tr></table></td></tr></table></td></tr></table></td></tr> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr></table></td></tr></table></td></tr><tr> <td width="600"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="552" align="center" style="vertical-align: middle; background-color:#ffffff; padding-left:24px; padding-right:24px;" bgcolor="#ffffff" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr> <tr> <td style="vertical-align: middle;" width="100%"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="552" align="center" style="vertical-align: bottom; " > <table class="table-w-full-mobile" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td style="vertical-align: bottom;" align="center" width="48%" class="stack-column-center"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td style="height:120px; " > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td ><table cellspacing="0" cellpadding="0" border="0"><tr><td width="120" ><img src="https://plugin.markaimg.com/public/43a815fe/eoRbQJjbNomN1QrfzlYBQ63bLAqadg.png" width="120" border="0" style="min-width:120px; width:120px; height: auto; display: block;"></td></tr></table></td></tr><tr><td height="12" style="height:12px; min-height:12px; line-height:12px;"></td></tr><tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td ><div style="line-height:24px;text-align:left;"><span style="color:#101828;font-weight:600;font-family:Inter,Arial,sans-serif;font-size:16px;line-height:24px;text-align:left;">Walla Form</span></div></td></tr><tr><td height="4" style="height:4px; min-height:4px; line-height:4px;"></td></tr><tr><td ><div style="line-height:24px;text-align:left;"><span style="color:#667085;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:left;">Form your insights.</span></div></td></tr></table></td></tr></table></td></tr></table></td><td class="stack-column-center" height="16" style="width:24px; min-width:24px; height:16px; min-height:16px;" width="24"></td> <td style="vertical-align: bottom;" align="center" width="48%" class="stack-column-center"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="100%" > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td ><div style="line-height:24px;text-align:left;"><span style="color:#667085;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:left;">Seoul, Mapodae-ro 122</span></div></td></tr><tr><td height="4" style="height:4px; min-height:4px; line-height:4px;"></td></tr><tr><td ><div style="line-height:24px;text-align:left;"><span style="color:#667085;font-family:Inter,Arial,sans-serif;font-size:15px;line-height:24px;text-align:left;"><a style="color:#667085;text-decoration:none;" href="mailto:cs@walla.my" target="_blank">cs@walla.my</a></span></div></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr> <tr><td height="24" style="height:24px; min-height:24px; line-height:24px;"></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></div></body></html>`
// Send the email
var recipientEmail = "------@------.---"; // Replace with the actual recipient's email
var subject = `<${FORM_TITLE}> ------------`;
var advancedOptions = {
htmlBody: emailBody,
charset: "UTF-8"
};
GmailApp.sendEmail(recipientEmail, subject, "", advancedOptions);
return ContentService.createTextOutput(JSON.stringify({result: "success"})).setMimeType(ContentService.MimeType.JSON);
}
// Helper function to format the date
function formatDate(date) {
return Utilities.formatDate(date, "Asia/Seoul", "yyyy-MM-dd HH:mm:ss");
}
// Helper function to format the answer based on its type
function getAnswerString(field) {
switch (field.type) {
case 'CHECKBOX':
case 'RADIO':
return Array.isArray(field.response) ? field.response.join(', ') : field.response;
case 'CHECKBOX_GRID':
case 'RADIO_GRID':
return field.response.map(el => el.lineResponse.join(', ')).join('; ');
case 'GEOLOCATION':
return Object.entries(field.response || {}).map(([key, value]) => `${key}: ${value}`).join(', ');
case 'HIDDEN':
return field.response || '';
default:
return Array.isArray(field.response) ? field.response.join(', ') : field.response;
}
}
3. '์ ๋ฐฐํฌ'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
4. ์ ํ์ '์น ์ฑ', ์ก์ธ์ค ๊ถํ์ด ์๋ ์ฌ์ฉ์๋ '๋ชจ๋ ์ฌ์ฉ์'๋ก ์ค์ ํด์ฃผ์ธ์.
5. ์ก์ธ์ค๋ฅผ ์น์ธํด์ฃผ์ธ์.
6. ๋ฐ์ ์ธ์ด ๋ ๋ฉ์ผ ์ฃผ์๋ฅผ ์ ํํด ์ฃผ์ธ์.
7. 'URL'์ ๋ณต์ฌํด์ฃผ์ธ์.
8. ์๋ผ์ '์ฐ๋ํ๊ธฐ' ํญ์์ '์นํ ๊ด๋ฆฌ' ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์.
9. URL์ ๋ถ์ฌ๋ฃ๊ณ ์นํ ์ ์ถ๊ฐํด์ฃผ์ธ์.
10. ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฅํ ํ, '์นํ ์ค์ '์์ ํ์ฑํ ํด์ฃผ์ธ์.
11. ์๋ต์ด ๋์ฐฉํ๋ฉด ์ด๋ฉ์ผ๋ก ์๋ฆผ์ ๋ฐ์ ์ ์์ด์.
๊ตฌ๊ธ์ํธ ์ฐ๋ํ๊ธฐ
1. ๊ตฌ๊ธ์ํธ์ 'ํ์ฅ ํ๋ก๊ทธ๋จ' ํญ์์ 'App Script'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
2. ์ ์คํฌ๋ฆฝํธ๋ฅผ ์ถ๊ฐํด์ฃผ์ธ์.
3. ๊ธฐ๋ณธ ๋ด์ฉ์ ๋ชจ๋ ์ง์ด ํ, ์๋์ ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ์ด์ฃผ์ธ์.
function doPost(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
ss.setSpreadsheetTimeZone('Asia/Seoul');
// Parsing the POST data to get the required data
var data = JSON.parse(e.postData.contents);
var formAnswers = data.form_answers;
var submittedAt = new Date(data.form_response.submitted_at);
var responseId = data.form_response.response_id.slice(0,10);
// First row: labels
if (sheet.getLastRow() === 0) {
var fieldLabels = formAnswers.map(function(answer) {
if (answer.type === 'RADIO_GRID' || answer.type === 'CHECKBOX_GRID') {
return answer.response.map(el => `${answer.label} - ${el.lineLabel}`);
}
return answer.label
}).flat();
var headers = ['Response ID', 'Time Submitted', ...fieldLabels]
sheet.appendRow(headers);
}
var rowData = formAnswers.map(field => {
switch (field.type) {
case 'CHECKBOX':
case 'RADIO': {
var isResponseArray = Array.isArray(field.response);
if (isResponseArray) {
return field.response.filter(el => Boolean(el)).join(', ');
}
return field.response || '';
}
case 'CHECKBOX_GRID':
case 'RADIO_GRID': {
var isLineResponseArray = Array.isArray(field.response.lineResponse)
return field.response.map(el => {
if (isLineResponseArray) {
return el.lineResponse.filter(el => Boolean(el)).join(', ');
}
return el.lineResponse || '';
})
}
case 'GEOLOCATION': {
var response = field.response || {};
var responseArray = Object.entries(response).map(el => `${el[0]}: ${el[1]}`);
return responseArray.join(', ');
}
case 'HIDDEN': {
return field.response === undefined || field.response === null
? ''
: field.response;
}
default: {
var response =
field.response === undefined || field.response === null ? '' : field.response;
if (Array.isArray(response)) {
return response.join(', ');
}
return response;
}
}
}).flat();
sheet.appendRow([responseId, submittedAt, ...rowData]);
return ContentService.createTextOutput(JSON.stringify({result: "success"})).setMimeType(ContentService.MimeType.JSON);
}
4. '์ ๋ฐฐํฌ'๋ฅผ ๋๋ฌ์ฃผ์ธ์.
5. ์ ํ์ '์น ์ฑ', ์ก์ธ์ค ๊ถํ์ด ์๋ ์ฌ์ฉ์๋ '๋ชจ๋ ์ฌ์ฉ์'๋ก ์ค์ ํด์ฃผ์ธ์.
6. ์ก์ธ์ค๋ฅผ ์น์ธํด์ฃผ์ธ์.
7. 'URL'์ ๋ณต์ฌํด์ฃผ์ธ์.
8. ์๋ผ์ '์ฐ๋ํ๊ธฐ' ํญ์์ '์นํ ๊ด๋ฆฌ' ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์.
9. URL์ ๋ถ์ฌ๋ฃ๊ณ ์นํ ์ ์ถ๊ฐํด์ฃผ์ธ์.
10. ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฅํ ํ, '์นํ ์ค์ '์์ ํ์ฑํ ํด์ฃผ์ธ์.
11. ์๋ต์ด ๋์ฐฉํ๋ฉด ๊ตฌ๊ธ์ํธ์ ์๋ต ๋ด์ฉ์ด ๊ธฐ๋ก๋ผ์.
์๋ผ์ ๊ฐ๋ฐ ๊ณํ์ ํ์ธํ๊ฑฐ๋ ์๋ก์ด ๊ธฐ๋ฅ์ ์ ์ํ๊ณ ์ถ์ผ์ ๊ฐ์? ์ ํ ๋ก๋๋งต ๋ฐ ๊ธฐ๋ฅ ์ ์ ํ์ด์ง๋ก ์ด๋ํด์!