Test VoIP push notifications for Telnyx WebRTC iOS (APNs) and Android (FCM) apps. Use when debugging push notification delivery, validating certificate/credential setup, or testing that a device receives VoIP pushes correctly.
中文简介正在准备中。当前显示原文说明。
Send and receive faxes programmatically. Manage fax applications and media. This skill provides Java SDK examples.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
<!-- Maven -->
<dependency>
<groupId>com.telnyx.sdk</groupId>
<artifactId>telnyx</artifactId>
<version>6.95.0</version>
</dependency>
// Gradle
implementation("com.telnyx.sdk:telnyx:6.95.0")
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
// fromEnv() reads TELNYX_API_KEY and TELNYX_PUBLIC_KEY (the public key is required for
// client.webhooks().unwrap() — webhook verification)
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
All examples below assume client is already initialized as shown above.
All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
import 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, then retry the request (bounded exponential backoff)
Thread.sleep(1000);
// ...retry the call here (give up after a few attempts)
}
throw e; // Re-throw: a failed request must never look like success to the caller
}
Common error codes: 401 invalid API key, 403 insufficient permissions,
404 resource not found, 422 validation error (check field formats),
429 rate limited (retry with exponential backoff).
+13125550001). Include the + prefix and country code. No spaces, dashes, or parentheses..autoPager() for automatic iteration: for (var item : page.autoPager()) { ... }. For manual control, use .hasNextPage() and .nextPage().This endpoint returns a list of your Fax Applications inside the 'data' attribute of the response. You can adjust which applications are listed by using filters. Fax Applications are used to configure how you send and receive faxes using the Programmable Fax API with Telnyx.
GET /fax_applications
import com.telnyx.sdk.models.faxapplications.FaxApplicationListPage;
import com.telnyx.sdk.models.faxapplications.FaxApplicationListParams;
FaxApplicationListPage page = client.faxApplications().list();
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), application_name (string), created_at (string), id (string), inbound (object), outbound (object), record_type (string), tags (array[string]), updated_at (string), webhook_event_failover_url (uri), webhook_event_url (uri), webhook_timeout_secs (integer | null)
Creates a new Fax Application based on the parameters sent in the request. The application name and webhook URL are required. Once created, you can assign phone numbers to your application using the /phone_numbers endpoint.
POST /fax_applications — Required: application_name, webhook_event_url
Optional: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), inbound (object), outbound (object), tags (array[string]), webhook_event_failover_url (uri), webhook_timeout_secs (integer | null)
import com.telnyx.sdk.models.faxapplications.FaxApplicationCreateParams;
import com.telnyx.sdk.models.faxapplications.FaxApplicationCreateResponse;
FaxApplicationCreateParams params = FaxApplicationCreateParams.builder()
.applicationName("fax-router")
.webhookEventUrl("https://example.com")
.build();
FaxApplicationCreateResponse faxApplication = client.faxApplications().create(params);
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), application_name (string), created_at (string), id (string), inbound (object), outbound (object), record_type (string), tags (array[string]), updated_at (string), webhook_event_failover_url (uri), webhook_event_url (uri), webhook_timeout_secs (integer | null)
Return the details of an existing Fax Application inside the 'data' attribute of the response.
GET /fax_applications/{id}
import com.telnyx.sdk.models.faxapplications.FaxApplicationRetrieveParams;
import com.telnyx.sdk.models.faxapplications.FaxApplicationRetrieveResponse;
FaxApplicationRetrieveResponse faxApplication = client.faxApplications().retrieve("1293384261075731499");
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), application_name (string), created_at (string), id (string), inbound (object), outbound (object), record_type (string), tags (array[string]), updated_at (string), webhook_event_failover_url (uri), webhook_event_url (uri), webhook_timeout_secs (integer | null)
Updates settings of an existing Fax Application based on the parameters of the request.
PATCH /fax_applications/{id} — Required: application_name, webhook_event_url
Optional: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), fax_email_recipient (string | null), inbound (object), outbound (object), tags (array[string]), webhook_event_failover_url (uri), webhook_timeout_secs (integer | null)
import com.telnyx.sdk.models.faxapplications.FaxApplicationUpdateParams;
import com.telnyx.sdk.models.faxapplications.FaxApplicationUpdateResponse;
FaxApplicationUpdateParams params = FaxApplicationUpdateParams.builder()
.id("1293384261075731499")
.applicationName("fax-router")
.webhookEventUrl("https://example.com")
.build();
FaxApplicationUpdateResponse faxApplication = client.faxApplications().update(params);
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), application_name (string), created_at (string), id (string), inbound (object), outbound (object), record_type (string), tags (array[string]), updated_at (string), webhook_event_failover_url (uri), webhook_event_url (uri), webhook_timeout_secs (integer | null)
Permanently deletes a Fax Application. Deletion may be prevented if the application is in use by phone numbers.
DELETE /fax_applications/{id}
import com.telnyx.sdk.models.faxapplications.FaxApplicationDeleteParams;
import com.telnyx.sdk.models.faxapplications.FaxApplicationDeleteResponse;
FaxApplicationDeleteResponse faxApplication = client.faxApplications().delete("1293384261075731499");
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), application_name (string), created_at (string), id (string), inbound (object), outbound (object), record_type (string), tags (array[string]), updated_at (string), webhook_event_failover_url (uri), webhook_event_url (uri), webhook_timeout_secs (integer | null)
Retrieve a paginated list of faxes sent or received on your account.
GET /faxes
import com.telnyx.sdk.models.faxes.FaxListPage;
import com.telnyx.sdk.models.faxes.FaxListParams;
FaxListPage page = client.faxes().list();
Returns: client_state (string), connection_id (string), created_at (date-time), direction (enum: inbound, outbound), failure_reason (string | null), from (string), from_display_name (string), id (uuid), internal_failure_reason (string | null), media_name (string), media_url (string), preview_url (string), quality (enum: normal, high, very_high, ultra_light, ultra_dark), record_type (enum: fax), status (enum: queued, media.processed, originated, sending, delivered, failed, initiated, receiving, media.processing, received), store_media (boolean), stored_media_url (string), to (string), updated_at (date-time), webhook_failover_url (string), webhook_url (string)
Send a fax. Files have size limits and page count limit validations. If a file is bigger than 50MB or has more than 350 pages it will fail with file_size_limit_exceeded and page_count_limit_exceeded respectively.
POST /faxes — Required: connection_id, from, to
Optional: black_threshold (integer), client_state (string), from_display_name (string), media_name (string), media_url (string), monochrome (boolean), preview_format (enum: pdf, tiff), quality (enum: normal, high, very_high, ultra_light, ultra_dark), store_media (boolean), store_preview (boolean), t38_enabled (boolean), webhook_url (string)
import com.telnyx.sdk.models.faxes.FaxCreateParams;
import com.telnyx.sdk.models.faxes.FaxCreateResponse;
FaxCreateParams params = FaxCreateParams.builder()
.connectionId("234423")
.from("+13125790015")
.to("+13127367276")
.mediaUrl("https://example.com/document.pdf")
.build();
FaxCreateResponse fax = client.faxes().create(params);
Returns: client_state (string), connection_id (string), created_at (date-time), direction (enum: inbound, outbound), failure_reason (string | null), from (string), from_display_name (string), id (uuid), internal_failure_reason (string | null), media_name (string), media_url (string), preview_url (string), quality (enum: normal, high, very_high, ultra_light, ultra_dark), record_type (enum: fax), status (enum: queued, media.processed, originated, sending, delivered, failed, initiated, receiving, media.processing, received), store_media (boolean), stored_media_url (string), to (string), updated_at (date-time), webhook_failover_url (string), webhook_url (string)
Returns the details of a single fax, including its current status.
GET /faxes/{id}
import com.telnyx.sdk.models.faxes.FaxRetrieveParams;
import com.telnyx.sdk.models.faxes.FaxRetrieveResponse;
FaxRetrieveResponse fax = client.faxes().retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
Returns: client_state (string), connection_id (string), created_at (date-time), direction (enum: inbound, outbound), failure_reason (string | null), from (string), from_display_name (string), id (uuid), internal_failure_reason (string | null), media_name (string), media_url (string), preview_url (string), quality (enum: normal, high, very_high, ultra_light, ultra_dark), record_type (enum: fax), status (enum: queued, media.processed, originated, sending, delivered, failed, initiated, receiving, media.processing, received), store_media (boolean), stored_media_url (string), to (string), updated_at (date-time), webhook_failover_url (string), webhook_url (string)
Delete a fax resource from your account.
DELETE /faxes/{id}
import com.telnyx.sdk.models.faxes.FaxDeleteParams;
client.faxes().delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
Cancel the outbound fax that is in one of the following states: queued, media.processed, originated or sending
POST /faxes/{id}/actions/cancel
import com.telnyx.sdk.models.faxes.actions.ActionCancelParams;
import com.telnyx.sdk.models.faxes.actions.ActionCancelResponse;
ActionCancelResponse response = client.faxes().actions().cancel("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
Returns: result (string)
Refreshes the inbound fax's media_url when it has expired
POST /faxes/{id}/actions/refresh
import com.telnyx.sdk.models.faxes.actions.ActionRefreshParams;
import com.telnyx.sdk.models.faxes.actions.ActionRefreshResponse;
ActionRefreshResponse response = client.faxes().actions().refresh("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
Returns: result (string)
Telnyx signs webhooks with Ed25519. Each request includes telnyx-signature-ed25519
and telnyx-timestamp headers. Always verify signatures in production:
Verification needs your account's public key (Mission Control Portal → API Keys → Public Key).
The SDK reads it from TELNYX_PUBLIC_KEY (the ## Setup block above passes it explicitly);
without it every valid webhook fails verification and the handler below returns 400.
import com.telnyx.sdk.core.UnwrapWebhookParams;
import com.telnyx.sdk.core.http.Headers;
// In your webhook handler (e.g., Spring — use raw body):
@PostMapping("/webhooks")
public ResponseEntity<String> handleWebhook(
@RequestBody String payload,
HttpServletRequest request) {
try {
Headers headers = Headers.builder()
.put("telnyx-signature-ed25519", request.getHeader("telnyx-signature-ed25519"))
.put("telnyx-timestamp", request.getHeader("telnyx-timestamp"))
.build();
var event = client.webhooks().unwrap(
UnwrapWebhookParams.builder()
.body(payload)
.headers(headers)
.build());
// Signature valid — process the event
System.out.println("Received webhook event");
return ResponseEntity.ok("OK");
} catch (Exception e) {
System.err.println("Webhook verification failed: " + e.getMessage());
return ResponseEntity.badRequest().body("Invalid signature");
}
}
The following webhook events are sent to your configured webhook URL.
All webhooks include telnyx-timestamp and telnyx-signature-ed25519 headers for Ed25519 signature verification. Use client.webhooks.unwrap() to verify.
| Event | Description |
|---|---|
fax.delivered | Fax Delivered |
fax.failed | Fax Failed |
fax.media.processed | Fax Media Processed |
fax.queued | Fax Queued |
fax.sending.started | Fax Sending Started |
fax.delivered
| Field | Type | Description |
|---|---|---|
data.record_type | enum: event | Identifies the type of the resource. |
data.id | uuid | Identifies the type of resource. |
data.occurred_at | date-time | ISO 8601 datetime of when the event occurred. |
data.event_type | enum: fax.delivered | The type of event being delivered. |
data.payload.call_duration_secs | integer | The duration of the call in seconds. |
data.payload.connection_id | string | The ID of the connection used to send the fax. |
data.payload.direction | enum: inbound, outbound | The direction of the fax. |
data.payload.fax_id | uuid | Identifies the fax. |
data.payload.original_media_url | string | The original URL to the PDF used for the fax's media. |
data.payload.media_name | string | The media_name used for the fax's media. |
data.payload.to | string | The phone number, in E.164 format, the fax will be sent to or SIP URI |
data.payload.from | string | The phone number, in E.164 format, the fax will be sent from. |
data.payload.user_id | uuid | Identifier of the user to whom the fax belongs |
data.payload.page_count | integer | Number of transferred pages |
data.payload.status | enum: delivered | The status of the fax. |
data.payload.client_state | string | State received from a command. |
meta.attempt | integer | The delivery attempt number. |
meta.delivered_to | uri | The URL the webhook was delivered to. |
fax.failed
| Field | Type | Description |
|---|---|---|
data.record_type | enum: event | Identifies the type of the resource. |
data.id | uuid | Identifies the type of resource. |
data.occurred_at | date-time | ISO 8601 datetime of when the event occurred. |
data.event_type | enum: fax.failed | The type of event being delivered. |
data.payload.connection_id | string | The ID of the connection used to send the fax. |
data.payload.direction | enum: inbound, outbound | The direction of the fax. |
data.payload.fax_id | uuid | Identifies the fax. |
data.payload.original_media_url | string | The original URL to the PDF used for the fax's media. |
data.payload.media_name | string | The media_name used for the fax's media. |
data.payload.to | string | The phone number, in E.164 format, the fax will be sent to or SIP URI |
data.payload.from | string | The phone number, in E.164 format, the fax will be sent from. |
data.payload.user_id | uuid | Identifier of the user to whom the fax belongs |
data.payload.failure_reason | string | Customer-facing cause of the fax failure. |
data.payload.internal_failure_reason | string | Internal, more granular cause of the fax failure. |
data.payload.status | enum: failed | The status of the fax. |
data.payload.client_state | string | State received from a command. |
meta.attempt | integer | The delivery attempt number. |
meta.delivered_to | uri | The URL the webhook was delivered to. |
fax.media.processed
| Field | Type | Description |
|---|---|---|
data.record_type | enum: event | Identifies the type of the resource. |
data.id | uuid | Identifies the type of resource. |
data.occurred_at | date-time | ISO 8601 datetime of when the event occurred. |
data.event_type | enum: fax.media.processed | The type of event being delivered. |
data.payload.connection_id | string | The ID of the connection used to send the fax. |
data.payload.direction | enum: inbound, outbound | The direction of the fax. |
data.payload.fax_id | uuid | Identifies the fax. |
data.payload.original_media_url | string | The original URL to the PDF used for the fax's media. |
data.payload.media_name | string | The media_name used for the fax's media. |
data.payload.to | string | The phone number, in E.164 format, the fax will be sent to or SIP URI |
data.payload.from | string | The phone number, in E.164 format, the fax will be sent from. |
data.payload.user_id | uuid | Identifier of the user to whom the fax belongs |
data.payload.status | enum: media.processed | The status of the fax. |
data.payload.client_state | string | State received from a command. |
meta.attempt | integer | The delivery attempt number. |
meta.delivered_to | uri | The URL the webhook was delivered to. |
fax.queued
| Field | Type | Description |
|---|---|---|
data.record_type | enum: event | Identifies the type of the resource. |
data.id | uuid | Identifies the type of resource. |
data.occurred_at | date-time | ISO 8601 datetime of when the event occurred. |
data.event_type | enum: fax.queued | The type of event being delivered. |
data.payload.connection_id | string | The ID of the connection used to send the fax. |
data.payload.direction | enum: inbound, outbound | The direction of the fax. |
data.payload.fax_id | uuid | Identifies the fax. |
data.payload.original_media_url | string | The original URL to the PDF used for the fax's media. |
data.payload.media_name | string | The media_name used for the fax's media. |
data.payload.to | string | The phone number, in E.164 format, the fax will be sent to or SIP URI |
data.payload.from | string | The phone number, in E.164 format, the fax will be sent from. |
data.payload.user_id | uuid | Identifier of the user to whom the fax belongs |
data.payload.status | enum: queued | The status of the fax. |
data.payload.client_state | string | State received from a command. |
meta.attempt | integer | The delivery attempt number. |
meta.delivered_to | uri | The URL the webhook was delivered to. |
fax.sending.started
| Field | Type | Description |
|---|---|---|
data.record_type | enum: event | Identifies the type of the resource. |
data.id | uuid | Identifies the type of resource. |
data.occurred_at | date-time | ISO 8601 datetime of when the event occurred. |
data.event_type | enum: fax.sending.started | The type of event being delivered. |
data.payload.connection_id | string | The ID of the connection used to send the fax. |
data.payload.direction | enum: inbound, outbound | The direction of the fax. |
data.payload.fax_id | uuid | Identifies the fax. |
data.payload.original_media_url | string | The original URL to the PDF used for the fax's media. |
data.payload.media_name | string | The media_name used for the fax's media. |
data.payload.to | string | The phone number, in E.164 format, the fax will be sent to or SIP URI |
data.payload.from | string | The phone number, in E.164 format, the fax will be sent from. |
data.payload.user_id | uuid | Identifier of the user to whom the fax belongs |
data.payload.status | enum: sending | The status of the fax. |
data.payload.client_state | string | State received from a command. |
meta.attempt | integer | The delivery attempt number. |
meta.delivered_to | uri | The URL the webhook was delivered to. |
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Test VoIP push notifications for Telnyx WebRTC iOS (APNs) and Android (FCM) apps. Use when debugging push notification delivery, validating certificate/credential setup, or testing that a device receives VoIP pushes correctly.
中文简介正在准备中。当前显示原文说明。
10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.
中文简介正在准备中。当前显示原文说明。
10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.
中文简介正在准备中。当前显示原文说明。
10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.
中文简介正在准备中。当前显示原文说明。
10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.
中文简介正在准备中。当前显示原文说明。
10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.
中文简介正在准备中。当前显示原文说明。