Message


Send Message

์‚ฌ์šฉ์ž๊ฐ€ ํ…์ŠคํŠธ ๋ฉ”์‹œ์ง€๋ฅผ ์ฑ„๋„์— ์ „์†กํ•ฉ๋‹ˆ๋‹ค.

Event

  • Event Name: send_message

Header

Name
Type
Descriptoin

App-Id

{ app id }

Authorization

{ access token }

Payload

Name
Type
Description

userId

string

๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ์‚ฌ์šฉ์ž ID

channelId

string

๋ฉ”์‹œ์ง€๊ฐ€ ์ „์†ก๋  ์ฑ„๋„ ID

message

string

ํ…์ŠคํŠธ ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ

Response

{
  "status": "sent",
  "messageId": "msg-12345",
  "channelId": "channel-67890",
  "userId": "user-abc123",
  "timestamp": "2025-01-18T12:00:00Z"
}

Retrieve Messages

ํŠน์ • ์ฑ„๋„์˜ ๋ฉ”์‹œ์ง€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.

Event

  • Event Name: retrieve_messages

Header

Name
Type
Descriptoin

App-Id

{ app id }

Authorization

{ access token }

Payload

Name
Type
Description

channelID

string

์กฐํšŒํ•  ์ฑ„๋„ ID

limit

int

๊ฐ€์ ธ์˜ฌ ๋ฉ”์‹œ์ง€ ์ˆ˜ (๊ธฐ๋ณธ๊ฐ’: 20)

before

string

ํŠน์ • ๋ฉ”์‹œ์ง€ ID ์ด์ „ ๋ฉ”์‹œ์ง€๋ฅผ ์กฐํšŒ

Response

{
  "event": "messages_retrieved",
  "data": {
    "channelId": "channel-67890",
    "messages": [
      {
        "messageId": "msg-12345",
        "userId": "12345",
        "content": "Hello, World!",
        "mediaUrl": null,
        "mediaType": null,
        "timestamp": "2025-01-18T12:09:00Z"
      },
      {
        "messageId": "msg-67890",
        "userId": "54321",
        "content": null,
        "mediaUrl": "https://cdn.example.com/uploads/image12345.jpg",
        "mediaType": "image/jpeg",
        "timestamp": "2025-01-18T12:10:00Z"
      }
    ]
  }
}

Receive real-time messages

์นœ๊ตฌ๊ฐ€ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ผ ๋•Œ๋งˆ๋‹ค ์‹ค์‹œ๊ฐ„์œผ๋กœ ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค.

Event

  • Name: received_message

Header

Name
Type
Descriptoin

App-Id

{ app id }

Authorization

{ access token }

Payload

Name
Type
Description

messageId

string

senderId

string

receiverId

string

content

string

ํ…์ŠคํŠธ ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ (๋ฏธ๋””์–ด ๋ฉ”์‹œ์ง€์ผ ๊ฒฝ์šฐ null).

mediaUrl

string

๋ฏธ๋””์–ด ํŒŒ์ผ URL (ํ…์ŠคํŠธ ๋ฉ”์‹œ์ง€์ผ ๊ฒฝ์šฐ null).

mediaType

string

๋ฏธ์–ด ํŒŒ์ผ ํ˜•์‹ (image/jpeg, video/mp4).๋‹ค

timestamp

string

Response

{
  "event": "received_message",
  "data": {
    "messageId": "msg-12345",
    "senderId": "user-67890",
    "receiverId": "user-12345",
    "content": "Hey, how are you?",
    "mediaUrl": null,
    "mediaType": null,
    "timestamp": "2025-01-18T12:15:00Z"
  }
}

Last updated