Loading...
Loading...
Create and manage video rooms for real-time video communication and conferencing. This skill provides Java SDK examples.
npx skill4agent add team-telnyx/skills telnyx-video-java<!-- Maven -->
<dependency>
<groupId>com.telnyx.sdk</groupId>
<artifactId>telnyx</artifactId>
<version>6.36.0</version>
</dependency>
// Gradle
implementation("com.telnyx.sdk:telnyx:6.36.0")import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
TelnyxClient client = TelnyxOkHttpClient.fromEnv();clientimport com.telnyx.sdk.errors.TelnyxServiceException;
try {
var result = client.messages().send(params);
} catch (TelnyxServiceException e) {
System.err.println("API error " + e.statusCode() + ": " + e.getMessage());
if (e.statusCode() == 422) {
System.err.println("Validation error — check required fields and formats");
} else if (e.statusCode() == 429) {
// Rate limited — wait and retry with exponential backoff
Thread.sleep(1000);
}
}401403404422429GET /room_compositionsimport com.telnyx.sdk.models.roomcompositions.RoomCompositionListPage;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionListParams;
RoomCompositionListPage page = client.roomCompositions().list();completed_atcreated_atdownload_urlduration_secsended_atformatidrecord_typeresolutionroom_idsession_idsize_mbstarted_atstatusupdated_atuser_idvideo_layoutwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsPOST /room_compositionsformatresolutionsession_idvideo_layoutwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsimport com.telnyx.sdk.models.roomcompositions.RoomCompositionCreateParams;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionCreateResponse;
RoomCompositionCreateResponse roomComposition = client.roomCompositions().create();completed_atcreated_atdownload_urlduration_secsended_atformatidrecord_typeresolutionroom_idsession_idsize_mbstarted_atstatusupdated_atuser_idvideo_layoutwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsGET /room_compositions/{room_composition_id}import com.telnyx.sdk.models.roomcompositions.RoomCompositionRetrieveParams;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionRetrieveResponse;
RoomCompositionRetrieveResponse roomComposition = client.roomCompositions().retrieve("5219b3af-87c6-4c08-9b58-5a533d893e21");completed_atcreated_atdownload_urlduration_secsended_atformatidrecord_typeresolutionroom_idsession_idsize_mbstarted_atstatusupdated_atuser_idvideo_layoutwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsDELETE /room_compositions/{room_composition_id}import com.telnyx.sdk.models.roomcompositions.RoomCompositionDeleteParams;
client.roomCompositions().delete("5219b3af-87c6-4c08-9b58-5a533d893e21");GET /room_participantsimport com.telnyx.sdk.models.roomparticipants.RoomParticipantListPage;
import com.telnyx.sdk.models.roomparticipants.RoomParticipantListParams;
RoomParticipantListPage page = client.roomParticipants().list();contextidjoined_atleft_atrecord_typesession_idupdated_atGET /room_participants/{room_participant_id}import com.telnyx.sdk.models.roomparticipants.RoomParticipantRetrieveParams;
import com.telnyx.sdk.models.roomparticipants.RoomParticipantRetrieveResponse;
RoomParticipantRetrieveResponse roomParticipant = client.roomParticipants().retrieve("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");contextidjoined_atleft_atrecord_typesession_idupdated_atGET /room_recordingsimport com.telnyx.sdk.models.roomrecordings.RoomRecordingListPage;
import com.telnyx.sdk.models.roomrecordings.RoomRecordingListParams;
RoomRecordingListPage page = client.roomRecordings().list();codeccompleted_atcreated_atdownload_urlduration_secsended_atidparticipant_idrecord_typeroom_idsession_idsize_mbstarted_atstatustypeupdated_atDELETE /room_recordingsimport com.telnyx.sdk.models.roomrecordings.RoomRecordingDeleteBulkParams;
import com.telnyx.sdk.models.roomrecordings.RoomRecordingDeleteBulkResponse;
RoomRecordingDeleteBulkResponse response = client.roomRecordings().deleteBulk();room_recordingsGET /room_recordings/{room_recording_id}import com.telnyx.sdk.models.roomrecordings.RoomRecordingRetrieveParams;
import com.telnyx.sdk.models.roomrecordings.RoomRecordingRetrieveResponse;
RoomRecordingRetrieveResponse roomRecording = client.roomRecordings().retrieve("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");codeccompleted_atcreated_atdownload_urlduration_secsended_atidparticipant_idrecord_typeroom_idsession_idsize_mbstarted_atstatustypeupdated_atDELETE /room_recordings/{room_recording_id}import com.telnyx.sdk.models.roomrecordings.RoomRecordingDeleteParams;
client.roomRecordings().delete("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");GET /room_sessionsimport com.telnyx.sdk.models.rooms.sessions.SessionList0Page;
import com.telnyx.sdk.models.rooms.sessions.SessionList0Params;
SessionList0Page page = client.rooms().sessions().list0();activecreated_atended_atidparticipantsrecord_typeroom_idupdated_atGET /room_sessions/{room_session_id}import com.telnyx.sdk.models.rooms.sessions.SessionRetrieveParams;
import com.telnyx.sdk.models.rooms.sessions.SessionRetrieveResponse;
SessionRetrieveResponse session = client.rooms().sessions().retrieve("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");activecreated_atended_atidparticipantsrecord_typeroom_idupdated_atPOST /room_sessions/{room_session_id}/actions/endimport com.telnyx.sdk.models.rooms.sessions.actions.ActionEndParams;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionEndResponse;
ActionEndResponse response = client.rooms().sessions().actions().end("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");resultPOST /room_sessions/{room_session_id}/actions/kickexcludeparticipantsimport com.telnyx.sdk.models.rooms.sessions.actions.ActionKickParams;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionKickResponse;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionsParticipantsRequest;
ActionKickParams params = ActionKickParams.builder()
.roomSessionId("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0")
.actionsParticipantsRequest(ActionsParticipantsRequest.builder().build())
.build();
ActionKickResponse response = client.rooms().sessions().actions().kick(params);resultPOST /room_sessions/{room_session_id}/actions/muteexcludeparticipantsimport com.telnyx.sdk.models.rooms.sessions.actions.ActionMuteParams;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionMuteResponse;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionsParticipantsRequest;
ActionMuteParams params = ActionMuteParams.builder()
.roomSessionId("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0")
.actionsParticipantsRequest(ActionsParticipantsRequest.builder().build())
.build();
ActionMuteResponse response = client.rooms().sessions().actions().mute(params);resultPOST /room_sessions/{room_session_id}/actions/unmuteexcludeparticipantsimport com.telnyx.sdk.models.rooms.sessions.actions.ActionUnmuteParams;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionUnmuteResponse;
import com.telnyx.sdk.models.rooms.sessions.actions.ActionsParticipantsRequest;
ActionUnmuteParams params = ActionUnmuteParams.builder()
.roomSessionId("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0")
.actionsParticipantsRequest(ActionsParticipantsRequest.builder().build())
.build();
ActionUnmuteResponse response = client.rooms().sessions().actions().unmute(params);resultGET /room_sessions/{room_session_id}/participantsimport com.telnyx.sdk.models.rooms.sessions.SessionRetrieveParticipantsPage;
import com.telnyx.sdk.models.rooms.sessions.SessionRetrieveParticipantsParams;
SessionRetrieveParticipantsPage page = client.rooms().sessions().retrieveParticipants("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");contextidjoined_atleft_atrecord_typesession_idupdated_atGET /roomsimport com.telnyx.sdk.models.rooms.RoomListPage;
import com.telnyx.sdk.models.rooms.RoomListParams;
RoomListPage page = client.rooms().list();active_session_idcreated_atenable_recordingidmax_participantsrecord_typesessionsunique_nameupdated_atwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsPOST /roomsenable_recordingmax_participantsunique_namewebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsimport com.telnyx.sdk.models.rooms.RoomCreateParams;
import com.telnyx.sdk.models.rooms.RoomCreateResponse;
RoomCreateParams params = RoomCreateParams.builder()
.uniqueName("my-meeting-room")
.maxParticipants(10)
.build();
RoomCreateResponse room = client.rooms().create(params);active_session_idcreated_atenable_recordingidmax_participantsrecord_typesessionsunique_nameupdated_atwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsGET /rooms/{room_id}import com.telnyx.sdk.models.rooms.RoomRetrieveParams;
import com.telnyx.sdk.models.rooms.RoomRetrieveResponse;
RoomRetrieveResponse room = client.rooms().retrieve("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");active_session_idcreated_atenable_recordingidmax_participantsrecord_typesessionsunique_nameupdated_atwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsPATCH /rooms/{room_id}enable_recordingmax_participantsunique_namewebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsimport com.telnyx.sdk.models.rooms.RoomUpdateParams;
import com.telnyx.sdk.models.rooms.RoomUpdateResponse;
RoomUpdateResponse room = client.rooms().update("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");active_session_idcreated_atenable_recordingidmax_participantsrecord_typesessionsunique_nameupdated_atwebhook_event_failover_urlwebhook_event_urlwebhook_timeout_secsDELETE /rooms/{room_id}import com.telnyx.sdk.models.rooms.RoomDeleteParams;
client.rooms().delete("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");token_ttl_secsrefresh_token_ttl_secsPOST /rooms/{room_id}/actions/generate_join_client_tokenrefresh_token_ttl_secstoken_ttl_secsimport com.telnyx.sdk.models.rooms.actions.ActionGenerateJoinClientTokenParams;
import com.telnyx.sdk.models.rooms.actions.ActionGenerateJoinClientTokenResponse;
ActionGenerateJoinClientTokenResponse response = client.rooms().actions().generateJoinClientToken("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");refresh_tokenrefresh_token_expires_attokentoken_expires_attoken_ttl_secsPOST /rooms/{room_id}/actions/refresh_client_tokenrefresh_tokentoken_ttl_secsimport com.telnyx.sdk.models.rooms.actions.ActionRefreshClientTokenParams;
import com.telnyx.sdk.models.rooms.actions.ActionRefreshClientTokenResponse;
ActionRefreshClientTokenParams params = ActionRefreshClientTokenParams.builder()
.roomId("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0")
.refreshToken("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ0ZWxueXhfdGVsZXBob255IiwiZXhwIjoxNTkwMDEwMTQzLCJpYXQiOjE1ODc1OTA5NDMsImlzcyI6InRlbG55eF90ZWxlcGhvbnkiLCJqdGkiOiJiOGM3NDgzNy1kODllLTRhNjUtOWNmMi0zNGM3YTZmYTYwYzgiLCJuYmYiOjE1ODc1OTA5NDIsInN1YiI6IjVjN2FjN2QwLWRiNjUtNGYxMS05OGUxLWVlYzBkMWQ1YzZhZSIsInRlbF90b2tlbiI6InJqX1pra1pVT1pNeFpPZk9tTHBFVUIzc2lVN3U2UmpaRmVNOXMtZ2JfeENSNTZXRktGQUppTXlGMlQ2Q0JSbWxoX1N5MGlfbGZ5VDlBSThzRWlmOE1USUlzenl6U2xfYURuRzQ4YU81MHlhSEd1UlNZYlViU1ltOVdJaVEwZz09IiwidHlwIjoiYWNjZXNzIn0.gNEwzTow5MLLPLQENytca7pUN79PmPj6FyqZWW06ZeEmesxYpwKh0xRtA0TzLh6CDYIRHrI8seofOO0YFGDhpQ")
.build();
ActionRefreshClientTokenResponse response = client.rooms().actions().refreshClientToken(params);tokentoken_expires_atGET /rooms/{room_id}/sessionsimport com.telnyx.sdk.models.rooms.sessions.SessionList1Page;
import com.telnyx.sdk.models.rooms.sessions.SessionList1Params;
SessionList1Page page = client.rooms().sessions().list1("0ccc7b54-4df3-4bca-a65a-3da1ecc777f0");activecreated_atended_atidparticipantsrecord_typeroom_idupdated_at