Skip to content
Start here

Fetch all chat messages of a session

client.RealtimeKit.Sessions.GetSessionChat(ctx, appID, sessionID, query) (*SessionGetSessionChatResponse, error)
GET/accounts/{account_id}/realtime/kit/{app_id}/sessions/{session_id}/chat

Returns a URL to download all chat messages of the session ID in CSV format.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Realtime AdminRealtime
ParametersExpand Collapse
appID string

The app identifier tag.

maxLength32
sessionID string
query SessionGetSessionChatParams
AccountID param.Field[string]

The account identifier tag.

maxLength32
ReturnsExpand Collapse
type SessionGetSessionChatResponse struct{…}
Data SessionGetSessionChatResponseDataoptional
ChatDownloadURL string

URL where the chat logs can be downloaded

ChatDownloadURLExpiry string

Time when the download URL will expire

Success booloptional

Fetch all chat messages of a session

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/realtime_kit"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.RealtimeKit.Sessions.GetSessionChat(
    context.TODO(),
    "app_id",
    "session_id",
    realtime_kit.SessionGetSessionChatParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Data)
}
{
  "data": {
    "chat_download_url": "chat_download_url",
    "chat_download_url_expiry": "chat_download_url_expiry"
  },
  "success": true
}
Returns Examples
{
  "data": {
    "chat_download_url": "chat_download_url",
    "chat_download_url_expiry": "chat_download_url_expiry"
  },
  "success": true
}