Loading...
Loading...
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides Java SDK examples.
npx skill4agent add team-telnyx/skills telnyx-webrtc-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);
}
}401403404422429.autoPager()for (var item : page.autoPager()) { ... }.hasNextPage().nextPage()GET /mobile_push_credentialsimport com.telnyx.sdk.models.mobilepushcredentials.MobilePushCredentialListPage;
import com.telnyx.sdk.models.mobilepushcredentials.MobilePushCredentialListParams;
MobilePushCredentialListPage page = client.mobilePushCredentials().list();aliascertificatecreated_atidprivate_keyproject_account_json_filerecord_typetypeupdated_atPOST /mobile_push_credentialstypecertificateprivate_keyaliasimport com.telnyx.sdk.models.mobilepushcredentials.MobilePushCredentialCreateParams;
import com.telnyx.sdk.models.mobilepushcredentials.PushCredentialResponse;
MobilePushCredentialCreateParams.CreateMobilePushCredentialRequest.Ios params = MobilePushCredentialCreateParams.CreateMobilePushCredentialRequest.Ios.builder()
.alias("LucyIosCredential")
.certificate("-----BEGIN CERTIFICATE----- MIIGVDCCBTKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END CERTIFICATE-----")
.privateKey("-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END RSA PRIVATE KEY-----")
.build();
PushCredentialResponse pushCredentialResponse = client.mobilePushCredentials().create(params);aliascertificatecreated_atidprivate_keyproject_account_json_filerecord_typetypeupdated_atpush_credential_idGET /mobile_push_credentials/{push_credential_id}import com.telnyx.sdk.models.mobilepushcredentials.MobilePushCredentialRetrieveParams;
import com.telnyx.sdk.models.mobilepushcredentials.PushCredentialResponse;
PushCredentialResponse pushCredentialResponse = client.mobilePushCredentials().retrieve("0ccc7b76-4df3-4bca-a05a-3da1ecc389f0");aliascertificatecreated_atidprivate_keyproject_account_json_filerecord_typetypeupdated_atpush_credential_idDELETE /mobile_push_credentials/{push_credential_id}import com.telnyx.sdk.models.mobilepushcredentials.MobilePushCredentialDeleteParams;
client.mobilePushCredentials().delete("0ccc7b76-4df3-4bca-a05a-3da1ecc389f0");GET /telephony_credentialsimport com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialListPage;
import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialListParams;
TelephonyCredentialListPage page = client.telephonyCredentials().list();created_atexpiredexpires_atidnamerecord_typeresource_idsip_passwordsip_usernameupdated_atuser_idPOST /telephony_credentialsconnection_idexpires_atnametagimport com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialCreateParams;
import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialCreateResponse;
TelephonyCredentialCreateParams params = TelephonyCredentialCreateParams.builder()
.connectionId("1234567890")
.build();
TelephonyCredentialCreateResponse telephonyCredential = client.telephonyCredentials().create(params);created_atexpiredexpires_atidnamerecord_typeresource_idsip_passwordsip_usernameupdated_atuser_idGET /telephony_credentials/{id}import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialRetrieveParams;
import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialRetrieveResponse;
TelephonyCredentialRetrieveResponse telephonyCredential = client.telephonyCredentials().retrieve("550e8400-e29b-41d4-a716-446655440000");created_atexpiredexpires_atidnamerecord_typeresource_idsip_passwordsip_usernameupdated_atuser_idPATCH /telephony_credentials/{id}connection_idexpires_atnametagimport com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialUpdateParams;
import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialUpdateResponse;
TelephonyCredentialUpdateResponse telephonyCredential = client.telephonyCredentials().update("550e8400-e29b-41d4-a716-446655440000");created_atexpiredexpires_atidnamerecord_typeresource_idsip_passwordsip_usernameupdated_atuser_idDELETE /telephony_credentials/{id}import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialDeleteParams;
import com.telnyx.sdk.models.telephonycredentials.TelephonyCredentialDeleteResponse;
TelephonyCredentialDeleteResponse telephonyCredential = client.telephonyCredentials().delete("550e8400-e29b-41d4-a716-446655440000");created_atexpiredexpires_atidnamerecord_typeresource_idsip_passwordsip_usernameupdated_atuser_id