01 - Page Assets Layers
커스텀 소개 매인페이지
OCIAL/1Day class int iron

n8n 1Day class

n8n 자동화하기

최근 개인적으로 n8n을 사용중인데 이걸 1Day로 사용하고 싶다는 이야기가 있어 강의를 하게 되었다.

그때 사용된 코드를 공유하고자 이렇게 작성해본다.

날짜 필터링

n8n에서는 날짜 계산을 Expression으로 처리할 수 있다.

.toDateTime().minus(1'day')

데이터 정규화 코드

function normalizeLink(item) {
  let link = itehttp://m.json.link || itehttp://m.json.guid || '';
  if (link.includes('news_rss.xml')) {
    link = itehttp://m.json.guid || '';
  }
  return link;
}

return [{
  json: {
    articles: items.map(i => ({
      title: i.json.title,
      link: normalizeLink(i),
      date: i.json.isoDate || i.json.date,
      source: i.json.creator || i.json.source || '',
      snippet: i.json.contentSnippet || ''
    }))
  }
}];

User Message

아래 RSS 기사 목록만을 바탕으로 오늘 꼭 알아야 할 내용을 정리하세요.

기사 목록:
{{ JSON.stringify($json.articles, null, 2) }}

작업 지시:

1. 중요하지 않은 기사는 과감히 생략하세요.
2. 같은 사건을 다룬 기사는 하나로 통합하세요.
3. 입력된 RSS 목록 안에서 오늘 꼭 알아야 할 핵심만 정리하세요.
4. 단순 사실 나열이 아니라, "왜 중요한지"와 "실무자 시사점" 중심으로 작성하세요.
5. 링크는 입력받은 link 값을 그대로 사용하세요.
6. 출퇴근길에 읽기 좋게 간결하고 명확하게 작성하세요.
7. 외부 정보나 추측을 추가하지 마세요.
8. 같은 사건의 복수 기사들은 가장 대표성이 높은 링크 1개만 사용하세요.
9. summary_html은 오늘의 핵심 3~5개를 짧게 요약하세요.
10. top10_html은 각 항목마다 "무슨 일(1줄) / 왜 중요(1줄) / 원문 링크" 형식으로 작성하세요.

반환 JSON 스키마:
{
  "headline": "오늘을 대표하는 1문장 헤드라인",
  "summary_html": "<ul><li>...</li><li>...</li></ul>",
  "top10_html": "<ul><li><strong>이슈제목</strong><br>무슨 일(1줄)<br>왜 중요(1줄) · <a href='링크'>원문</a></li></ul>",
  "action_html": "<p>실무자 관점 한 줄</p>",
  "learn_keywords_html": "<ul><li>키워드 — 왜 공부해야 하는지</li></ul>"
}

System Message

You are a news briefing editor.
Write concise, high-signal summaries for mobile reading.
Focus on:

why it matters
practical implications for readers

Return valid JSON only.
Do not include explanations outside the JSON.
Use only these HTML tags inside string fields: <p>, <br>, <ul>, <li>, <strong>, <a>.
Strictly follow the requested output schema.

Output Parser

{
  "headline": "string",
  "summary_html": "string",
  "top10_html": "string",
  "action_html": "string",
  "learn_keywords_html": "string"
}

Gamini API Key 발급

Gemini API Key 주소: https://aistudio.google.com/app/api-keys


메일 제목

{{ $('Schedule Trigger').item.json.timestamp.toDateTime().format('yy년 MM월 dd일') }}

본문

<!doctype html>
<html lang="ko">
    <head>
        <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <title>Daily News Briefing</title>
</head>
<body style="margin:0;padding:0;background:#f3f4f6;font-family:Apple SD Gothic Neo, Pretendard, Segoe UI, Roboto, Helvetica, Arial, sans-serif;color:#111827;">
    <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#f3f4f6;margin:0;padding:32px 12px;">
        <tr>
            <td align="center">

                <table role="presentation" width="680" cellpadding="0" cellspacing="0" style="width:680px;max-width:100%;background:#ffffff;border:1px solid #e5e7eb;border-radius:20px;overflow:hidden;">

                    <!-- Top bar -->
          <tr>
              <td style="padding:0;background:#ffffff;">
                  <table role="presentation" width="100%" cellpadding="0" cellspacing="0">
                      <tr>
                          <td style="padding:20px 24px 12px;border-bottom:1px solid #f1f5f9;">
                              <div style="font-size:12px;line-height:1.4;color:#6b7280;letter-spacing:.2px;">
                                  DAILY BRIEFING
                    </div>
                    <div style="margin-top:8px;font-size:28px;line-height:1.3;font-weight:800;color:#111827;">
                        {{ $json.output.headline }}
                    </div>
                    <div style="margin-top:10px;font-size:13px;line-height:1.5;color:#6b7280;">
                        {{$now.format('yyyy년 MM월 dd일')}} · 오늘 꼭 알아야 할 핵심만 간결하게
                    </div>
                  </td>
                </tr>
              </table>
            </td>
          </tr>

          <!-- Intro -->
          <tr>
              <td style="padding:24px 24px 8px;">
                  <div style="font-size:15px;line-height:1.75;color:#374151;">
                      하루를 시작하기 전에 꼭 짚고 가야 할 이슈만 골라 정리했어요.
                단순한 사실보다 <strong>왜 중요한지</strong>, 그리고 <strong>실무적으로 무엇을 봐야 하는지</strong>에 초점을 맞췄어요.
              </div>
            </td>
          </tr>

          <!-- Summary -->
          <tr>
              <td style="padding:16px 24px 8px;">
                  <div style="font-size:18px;font-weight:700;line-height:1.4;color:#111827;margin-bottom:12px;">
                      오늘의 핵심
              </div>
              <div style="background:#f8fafc;border:1px solid #e5e7eb;border-radius:16px;padding:16px 18px;font-size:14px;line-height:1.75;color:#374151;">
                  {{ $json.output.summary_html }}
              </div>
            </td>
          </tr>

          <!-- Main issues -->
          <tr>
              <td style="padding:16px 24px 8px;">
                  <div style="font-size:18px;font-weight:700;line-height:1.4;color:#111827;margin-bottom:12px;">
                      꼭 봐야 할 이슈
              </div>
              <div style="background:#ffffff;border:1px solid #e5e7eb;border-radius:16px;padding:6px 18px 2px;">
                  <div style="font-size:14px;line-height:1.8;color:#111827;">
                      {{ $json.output.top10_html }}
                </div>
              </div>
            </td>
          </tr>

          <!-- Action -->
          <tr>
              <td style="padding:16px 24px 8px;">
                  <div style="font-size:18px;font-weight:700;line-height:1.4;color:#111827;margin-bottom:12px;">
                      실무자 메모
              </div>
              <div style="background:#111827;border-radius:16px;padding:16px 18px;font-size:14px;line-height:1.75;color:#f9fafb;">
                  {{ $json.output.action_html }}
              </div>
            </td>
          </tr>

          <!-- Learning keywords -->
          <tr>
              <td style="padding:16px 24px 24px;">
                  <div style="font-size:18px;font-weight:700;line-height:1.4;color:#111827;margin-bottom:12px;">
                      함께 보면 좋은 키워드
              </div>
              <div style="background:#fff7ed;border:1px solid #fed7aa;border-radius:16px;padding:16px 18px;font-size:14px;line-height:1.75;color:#7c2d12;">
                  {{ $json.output.learn_keywords_html }}
              </div>
            </td>
          </tr>

          <!-- Footer -->
          <tr>
              <td style="padding:18px 24px;background:#f9fafb;border-top:1px solid #e5e7eb;">
                  <div style="font-size:12px;line-height:1.7;color:#6b7280;">
                      이 브리핑은 입력된 기사 목록을 바탕으로 자동 정리되었어요. 중요한 의사결정 전에는 원문도 함께 확인해 주세요.
              </div>
              <div style="margin-top:8px;font-size:12px;line-height:1.5;color:#9ca3af;">
                  Generated by n8n + Gemini
              </div>
            </td>
          </tr>

        </table>

      </td>
    </tr>
  </table>
</body>
</html>

그래서 강의는?

자세한 내용 즉 강의가 듣고 싶으면 신청하면 된다. 어디로?

OCIAL 홈페이지 여기로 신청하시면 되긴 하는데 아마 날짜가 지나있을 수도 있습니다.

아직 사이트가 정식 오픈 전이라... 그럼 그냥 광고나 해봐야겠다.

OCIAL

OCIAL은 'Social'에서 'S'를 뺀 이름으로, 사회를 대표하는 의미를 담고 있습니다.

영단어에서 s를 뺀다는 것은 복수형을 단수형으로 바꾼다는 의미입니다.

사회를 나타내는 단어인 Social에서 S를 뺀 OCIAL은 사회를 대표한다는 의미를 담고 있습니다.

OCIAL's Vision

데이터를 통해 과거와 미래를 연결하고,

지속적인 학습과 협업을 통해 혁신적인 아이디어를 실현하며,

IT, 교육, 비즈니스의 힘으로 사회적 문제를 해결하는 것을 목표로 합니다.

OCIAL은 단순한 네트워크를 넘어,

모든 구성원이 성장하고, 협력하며, 사회적 가치를 만들어가는 플랫폼을 지향합니다.

함께 배우고 도전하며, 더 나은 미래를 만들어가고자 다양한 활동을 하고 있습니다.


그럼 뭐... 나중에 다시 열기를 빌어주세요!

사실 프롬프트 보면 어떻게 따라할 수 있을 것 같긴 한데 뭐 그럼 이 글을 읽으신 분이 이득 보는거죠 뭐 ㅎㅎ...

참고로 aws + n8n이라 추천합니다.

그럼 이만!

:wq