Media Upload Management

1. Request S3 Upload URL

μ‚¬μš©μžκ°€ μ—…λ‘œλ“œν•  νŒŒμΌμ„ μœ„ν•œ S3 μ„œλͺ…λœ URL을 μš”μ²­ν•˜λŠ” REST APIμž…λ‹ˆλ‹€.

Method: POST /media/upload-url

Headers

Name
Value

Content-Type

application/json

Authorization

{ access token }

App-Id

{ app id }

Body

Name
Type
Description

fileName

string

μ—…λ‘œλ“œν•  파일 이름 (예: image123.jpg)

fileType

string

파일 ν˜•μ‹ (예: image/jpeg)

Response

Status Code
Body

200

json { "uploadUrl": "https://your-s3-bucket.s3.amazonaws.com/uploads/image123.jpg?AWSAccessKeyId=...", "fileUrl": "https://cdn.example.com/uploads/image123.jpg" }

400

json { "error": "Invalid request" }


2. Notify Uploaded Media

파일 μ—…λ‘œλ“œ ν›„ ν΄λΌμ΄μ–ΈνŠΈκ°€ μ„œλ²„λ‘œ μ—…λ‘œλ“œ μ™„λ£Œλ₯Ό μ•Œλ¦½λ‹ˆλ‹€. μ΄λ²€νŠΈλŠ” μ±„νŒ… λ©”μ‹œμ§€ μ „μ†‘μœΌλ‘œ μ΄μ–΄μ§‘λ‹ˆλ‹€.

Event

  • Event Name: notify_uploaded_media

Headers

Name
Type
Description

App-Id

{ app id }

μ•± μ‹λ³„μž

Authorization

{ access token }

μ‚¬μš©μž 인증 토큰

Payload

Name
Type
Description

channelId

string

λ©”μ‹œμ§€κ°€ 전솑될 채널 ID

userId

string

λ©”μ‹œμ§€λ₯Ό 보낸 μ‚¬μš©μž ID

fileUrl

string

S3 λ˜λŠ” CloudFront URL

fileType

string

파일 ν˜•μ‹ (image/jpeg, video/mp4)

caption

string

νŒŒμΌμ— λŒ€ν•œ μ„€λͺ… (선택)

Response

{
  "event": "media_message_notified",
  "data": {
    "status": "success",
    "messageId": "msg-12345",
    "channelId": "channel-67890",
    "fileUrl": "https://cdn.example.com/uploads/image123.jpg",
    "fileType": "image/jpeg",
    "caption": "Check this out!",
    "timestamp": "2025-01-18T12:15:00Z"
  }
}

3. Broadcast Media Message

λ‹€λ₯Έ μ‚¬μš©μžμ—κ²Œ μ—…λ‘œλ“œλœ 파일 정보λ₯Ό ν¬ν•¨ν•œ λ©”μ‹œμ§€λ₯Ό μ‹€μ‹œκ°„μœΌλ‘œ λΈŒλ‘œλ“œμΊμŠ€νŠΈν•©λ‹ˆλ‹€.

Event

  • Event Name: received_message

Headers

Name
Type
Description

App-Id

{ app id }

μ•± μ‹λ³„μž

Authorization

{ access token }

μ‚¬μš©μž 인증 토큰

Payload

Name
Type
Description

messageId

string

λ©”μ‹œμ§€ ID

senderId

string

λ©”μ‹œμ§€ 보낸 μ‚¬μš©μž ID

receiverId

string

λ©”μ‹œμ§€ λ°›λŠ” μ‚¬μš©μž ID

fileUrl

string

S3 λ˜λŠ” CloudFront URL

fileType

string

파일 ν˜•μ‹ (image/jpeg, video/mp4)

caption

string

파일 μ„€λͺ… (ν…μŠ€νŠΈ λ©”μ‹œμ§€μΌ 경우 null)

timestamp

string

λ©”μ‹œμ§€ 전솑 μ‹œκ°„

Response

{
  "event": "media_message_broadcast",
  "data": {
    "messageId": "msg-12345",
    "senderId": "user-67890",
    "receiverId": "user-12345",
    "fileUrl": "https://cdn.example.com/uploads/image123.jpg",
    "fileType": "image/jpeg",
    "caption": "Check this out!",
    "timestamp": "2025-01-18T12:15:00Z"
  }
}

Last updated