Skip to content

feat(content-studio): Instagram publish 검증 결과 + 후속 작업 (IGAA 토큰 라우팅, 매거진 브릿지, carousel) #616

@thxforall

Description

@thxforall

배경

#596~#600 (PR #612) 으로 Content Studio Instagram publish 파이프라인이 머지됨. CORTIS 매거진 thumbnail 로 PRD 계정(decodedmag) 단일 피드 발행 smoke test 완료.

검증 일시: 2026-05-28
검증 매거진: editorial_articles d3583884-4a08-4f98-b4f7-e34d17b5debf
발행 media_id: 17940544812216084

검증된 동작

  • Meta Graph API 컨테이너 생성 → 폴링 → 발행 3단계 정상
  • 4:5 (1024×1280) JPEG 종횡비/포맷 가드 통과
  • 한국어 caption (685자) 정상 전달
  • decodedmag PRD 피드에 실제 게시 확인

발견된 이슈 / 후속 작업

1. backend base URL 분기 누락 (blocker)

packages/api-server/src/domains/content_studio/service.rsReqwestInstagramPublishClienthttps://graph.facebook.com/v21.0 로 하드코딩.

.env.devINSTAGRAM_PUBLISH_ACCESS_TOKEN 은 prefix IGAA (Instagram Login Direct API token). 이 토큰은 https://graph.instagram.com 만 받음. 현재 코드로는 Invalid OAuth access token - Cannot parse access token 으로 무조건 실패.

  • token prefix(IGAA / EAA) 자동 분기 또는 INSTAGRAM_PUBLISH_API_BASE env 로 외부화
  • Graph API 버전도 env 로 (INSTAGRAM_GRAPH_API_VERSION 이미 .env.dev에 존재 — config 에서 읽기)
  • 분기 로직에 대한 unit test 추가

2. 매거진(editorial_articles) ↔ content_studio 브릿지 부재

현재 build_packet_for_postposts row 기준. editorial_articles draft (예: d3583884-...) 을 그대로 publish 흐름에 태울 수 없음. 임시 검증은 thumbnail 만 다운받아 외부 호스팅으로 우회함.

  • editorial_articles → content_packet 어댑터 (layout_json.title/subtitle/hero 추출 → packet)
  • 또는 매거진 전용 publish endpoint 신설 (/api/v1/editorial-articles/{id}/publish/instagram)
  • 매거진 publish 후 article status 갱신 (published_at, link to media_id)

3. 자산 자동 전처리 누락

  • editorial_articles 의 hero/thumbnail 은 R2 PNG 1024×1536 (2:3). IG feed 가드 (4:5 ~ 1.91:1) 통과 안 함.

  • 현재 publish-assets.ts 는 content-studio-assets 버킷의 jpg/jpeg 만 허용.

  • 매거진 publish 시 PNG→JPEG 변환 + 4:5 crop 자동 처리 (ai-server or web layer)

  • 변환 결과를 content-studio-assets 버킷에 업로드 후 그 URL 사용

  • thumbnail 외 hero_image_url 도 활용 가능하도록

4. Carousel (multi-image) 미지원

매거진은 sections(curation_card) 다수 보유. 현 publish API 는 format=instagram_feed 단일 이미지만 허용.

  • DB: content_publish_jobs.format / content_variants.format CHECK 에 instagram_carousel 추가
  • service: publish_instagram_carousel_variant 신규 — child container N개 → CAROUSEL container → publish
  • gauard: 모든 child 동일 비율 (1:1 또는 4:5), 2~10장
  • UI: admin 에 carousel 발행 컨트롤 + 미리보기

5. PRD 운영 가드

  • PRD 발행 전 확인 다이얼로그 (decodedmag 계정 명시)
  • content_publish_jobs 의 metrics / 알림 (실패 → Slack 등)
  • 토큰 만료 모니터링 (long-lived 60일)

참고

  • 검증 스크립트: /tmp/test_ig_publish.sh (로컬에만 존재, 영구화 필요시 scripts/로 이동)
  • caption draft: /tmp/ig_caption.txt
  • 변환된 이미지: /tmp/cortis_ig.jpg (4:5 1024×1280 JPEG)
  • 임시 호스팅: https://files.catbox.moe/rn35o7.jpg (catbox.moe, 영구)

참조 PR/이슈

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions