# Active Session ## Fetch details of an active session `client.RealtimeKit.ActiveSession.GetActiveSession(ctx, appID, meetingID, query) (*ActiveSessionGetActiveSessionResponse, error)` **get** `/accounts/{account_id}/realtime/kit/{app_id}/meetings/{meeting_id}/active-session` Returns details of an ongoing active session for the given meeting ID. ### Parameters - `appID string` The app identifier tag. - `meetingID string` - `query ActiveSessionGetActiveSessionParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type ActiveSessionGetActiveSessionResponse struct{…}` - `Data ActiveSessionGetActiveSessionResponseData` - `ID string` ID of the session - `AssociatedID string` ID of the meeting this session is associated with. In the case of V2 meetings, it is always a UUID. In V1 meetings, it is a room name of the form `abcdef-ghijkl` - `CreatedAt string` timestamp when session created - `LiveParticipants float64` number of participants currently in the session - `MaxConcurrentParticipants float64` number of maximum participants that were in the session - `MeetingDisplayName string` Title of the meeting this session belongs to - `MinutesConsumed float64` number of minutes consumed since the session started - `OrganizationID string` App id that hosted this session - `StartedAt string` timestamp when session started - `Status ActiveSessionGetActiveSessionResponseDataStatus` current status of session - `const ActiveSessionGetActiveSessionResponseDataStatusLive ActiveSessionGetActiveSessionResponseDataStatus = "LIVE"` - `const ActiveSessionGetActiveSessionResponseDataStatusEnded ActiveSessionGetActiveSessionResponseDataStatus = "ENDED"` - `Type ActiveSessionGetActiveSessionResponseDataType` type of session - `const ActiveSessionGetActiveSessionResponseDataTypeMeeting ActiveSessionGetActiveSessionResponseDataType = "meeting"` - `const ActiveSessionGetActiveSessionResponseDataTypeLivestream ActiveSessionGetActiveSessionResponseDataType = "livestream"` - `const ActiveSessionGetActiveSessionResponseDataTypeParticipant ActiveSessionGetActiveSessionResponseDataType = "participant"` - `UpdatedAt string` timestamp when session was last updated - `BreakoutRooms []unknown` - `EndedAt string` timestamp when session ended - `Meta unknown` Any meta data about session. - `Success bool` ### Example ```go 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.ActiveSession.GetActiveSession( context.TODO(), "app_id", "meeting_id", realtime_kit.ActiveSessionGetActiveSessionParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "id": "id", "associated_id": "associated_id", "created_at": "created_at", "live_participants": 0, "max_concurrent_participants": 0, "meeting_display_name": "meeting_display_name", "minutes_consumed": 0, "organization_id": "organization_id", "started_at": "started_at", "status": "LIVE", "type": "meeting", "updated_at": "updated_at", "breakout_rooms": [ {} ], "ended_at": "ended_at", "meta": {} }, "success": true } ``` ## Kick participants from an active session `client.RealtimeKit.ActiveSession.KickParticipants(ctx, appID, meetingID, params) (*ActiveSessionKickParticipantsResponse, error)` **post** `/accounts/{account_id}/realtime/kit/{app_id}/meetings/{meeting_id}/active-session/kick` Kicks one or more participants from an active session using user ID or custom participant ID. ### Parameters - `appID string` The app identifier tag. - `meetingID string` - `params ActiveSessionKickParticipantsParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `CustomParticipantIDs param.Field[[]string]` Body param - `ParticipantIDs param.Field[[]string]` Body param ### Returns - `type ActiveSessionKickParticipantsResponse struct{…}` - `Data ActiveSessionKickParticipantsResponseData` - `Action string` - `Participants []ActiveSessionKickParticipantsResponseDataParticipant` - `ID string` ID of the session participant - `CreatedAt string` - `UpdatedAt string` - `Email string` Email of the session participant. - `Name string` Name of the session participant. - `Picture string` A URL pointing to a picture of the participant. - `Success bool` ### Example ```go 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.ActiveSession.KickParticipants( context.TODO(), "app_id", "meeting_id", realtime_kit.ActiveSessionKickParticipantsParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CustomParticipantIDs: cloudflare.F([]string{"string"}), ParticipantIDs: cloudflare.F([]string{"string"}), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "action": "action", "participants": [ { "id": "id", "created_at": "created_at", "updated_at": "updated_at", "email": "email", "name": "name", "picture": "picture" } ] }, "success": true } ``` ## Kick all participants `client.RealtimeKit.ActiveSession.KickAllParticipants(ctx, appID, meetingID, body) (*ActiveSessionKickAllParticipantsResponse, error)` **post** `/accounts/{account_id}/realtime/kit/{app_id}/meetings/{meeting_id}/active-session/kick-all` Kicks all participants from an active session for the given meeting ID. ### Parameters - `appID string` The app identifier tag. - `meetingID string` - `body ActiveSessionKickAllParticipantsParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type ActiveSessionKickAllParticipantsResponse struct{…}` - `Data ActiveSessionKickAllParticipantsResponseData` - `Action string` - `KickedParticipantsCount float64` - `Success bool` ### Example ```go 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.ActiveSession.KickAllParticipants( context.TODO(), "app_id", "meeting_id", realtime_kit.ActiveSessionKickAllParticipantsParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "action": "action", "kicked_participants_count": 0 }, "success": true } ``` ## Create a poll `client.RealtimeKit.ActiveSession.NewPoll(ctx, appID, meetingID, params) (*ActiveSessionNewPollResponse, error)` **post** `/accounts/{account_id}/realtime/kit/{app_id}/meetings/{meeting_id}/active-session/poll` Creates a new poll in an active session for the given meeting ID. ### Parameters - `appID string` The app identifier tag. - `meetingID string` - `params ActiveSessionNewPollParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `Options param.Field[[]string]` Body param: Different options for the question - `Question param.Field[string]` Body param: Question of the poll - `Anonymous param.Field[bool]` Body param: if voters on a poll are anonymous - `HideVotes param.Field[bool]` Body param: if votes on an option are visible before a person votes ### Returns - `type ActiveSessionNewPollResponse struct{…}` - `Data ActiveSessionNewPollResponseData` - `Action string` - `Poll ActiveSessionNewPollResponseDataPoll` - `ID string` ID of the poll - `Options []ActiveSessionNewPollResponseDataPollOption` Answer options - `Count float64` - `Text string` Text of the answer option - `Votes []ActiveSessionNewPollResponseDataPollOptionsVote` - `ID string` - `Name string` - `Question string` Question asked by the poll - `Anonymous bool` - `CreatedBy string` - `HideVotes bool` - `Voted []string` - `Success bool` ### Example ```go 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.ActiveSession.NewPoll( context.TODO(), "app_id", "meeting_id", realtime_kit.ActiveSessionNewPollParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Options: cloudflare.F([]string{"string"}), Question: cloudflare.F("question"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "action": "action", "poll": { "id": "id", "options": [ { "count": 0, "text": "text", "votes": [ { "id": "id", "name": "name" } ] } ], "question": "question", "anonymous": true, "created_by": "created_by", "hide_votes": true, "voted": [ "string" ] } }, "success": true } ```