Instalar en Claude Code
Copiargit clone --depth 1 https://github.com/team-telnyx/ai /tmp/telnyx-messaging-hosted-java && cp -r /tmp/telnyx-messaging-hosted-java/providers/claude/plugin/skills/telnyx-messaging-hosted-java ~/.claude/skills/telnyx-messaging-hosted-javaDespués abre una sesión nueva de Claude Code; el skill carga automáticamente.
Definición
SKILL.md
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
# Telnyx Messaging Hosted - Java
## Installation
```text
<!-- 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")
```
## Setup
```java
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
```
All examples below assume `client` is already initialized as shown above.
## Error Handling
All API calls can fail with network errors, rate limits (429), validation errors (422),
or authentication errors (401). Always handle errors in production code:
```java
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 and retry with exponential backoff
Thread.sleep(1000);
}
}
```
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).
## Important Notes
- **Phone numbers** must be in E.164 format (e.g., `+13125550001`). Include the `+` prefix and country code. No spaces, dashes, or parentheses.
- **Pagination:** List methods return a page. Use `.autoPager()` for automatic iteration: `for (var item : page.autoPager()) { ... }`. For manual control, use `.hasNextPage()` and `.nextPage()`.
## Send an RCS message
`POST /messages/rcs` — Required: `agent_id`, `to`, `messaging_profile_id`, `agent_message`
Optional: `mms_fallback` (object), `sms_fallback` (object), `type` (enum: RCS), `webhook_url` (url)
```java
import com.telnyx.sdk.models.messages.RcsAgentMessage;
import com.telnyx.sdk.models.messages.rcs.RcSendParams;
import com.telnyx.sdk.models.messages.rcs.RcSendResponse;
RcSendParams params = RcSendParams.builder()
.agentId("Agent007")
.agentMessage(RcsAgentMessage.builder().build())
.messagingProfileId("550e8400-e29b-41d4-a716-446655440000")
.to("+13125551234")
.build();
RcSendResponse response = client.messages().rcs().send(params);
```
Returns: `body` (object), `direction` (string), `encoding` (string), `from` (object), `id` (string), `messaging_profile_id` (string), `organization_id` (string), `received_at` (date-time), `record_type` (string), `to` (array[object]), `type` (string), `wait_seconds` (float)
## Generate RCS deeplink
Generate a deeplink URL that can be used to start an RCS conversation with a specific agent.
`GET /messages/rcs/deeplinks/{agent_id}`
```java
import com.telnyx.sdk.models.messages.rcs.RcGenerateDeeplinkParams;
import com.telnyx.sdk.models.messages.rcs.RcGenerateDeeplinkResponse;
RcGenerateDeeplinkResponse response = client.messages().rcs().generateDeeplink("550e8400-e29b-41d4-a716-446655440000");
```
Returns: `url` (string)
## List all RCS agents
`GET /messaging/rcs/agents`
```java
import com.telnyx.sdk.models.messaging.rcs.agents.AgentListPage;
import com.telnyx.sdk.models.messaging.rcs.agents.AgentListParams;
AgentListPage page = client.messaging().rcs().agents().list();
```
Returns: `agent_id` (string), `agent_name` (string), `created_at` (date-time), `enabled` (boolean), `profile_id` (uuid), `updated_at` (date-time), `user_id` (string), `webhook_failover_url` (url), `webhook_url` (url)
## Retrieve an RCS agent
`GET /messaging/rcs/agents/{id}`
```java
import com.telnyx.sdk.models.messaging.rcs.agents.AgentRetrieveParams;
import com.telnyx.sdk.models.rcsagents.RcsAgentResponse;
RcsAgentResponse rcsAgentResponse = client.messaging().rcs().agents().retrieve("550e8400-e29b-41d4-a716-446655440000");
```
Returns: `agent_id` (string), `agent_name` (string), `created_at` (date-time), `enabled` (boolean), `profile_id` (uuid), `updated_at` (date-time), `user_id` (string), `webhook_failover_url` (url), `webhook_url` (url)
## Modify an RCS agent
`PATCH /messaging/rcs/agents/{id}`
Optional: `profile_id` (uuid), `webhook_failover_url` (url), `webhook_url` (url)
```java
import com.telnyx.sdk.models.messaging.rcs.agents.AgentUpdateParams;
import com.telnyx.sdk.models.rcsagents.RcsAgentResponse;
RcsAgentResponse rcsAgentResponse = client.messaging().rcs().agents().update("550e8400-e29b-41d4-a716-446655440000");
```
Returns: `agent_id` (string), `agent_name` (string), `created_at` (date-time), `enabled` (boolean), `profile_id` (uuid), `updated_at` (date-time), `user_id` (string), `webhook_failover_url` (url), `webhook_url` (url)
## Check RCS capabilities (batch)
`POST /messaging/rcs/bulk_capabilities` — Required: `agent_id`, `phone_numbers`
```java
import com.telnyx.sdk.models.messaging.rcs.RcListBulkCapabilitiesParams;
import com.telnyx.sdk.models.messaging.rcs.RcListBulkCapabilitiesResponse;
RcListBulkCapabilitiesParams params = RcListBulkCapabilitiesParams.builder()
.agentId("TestAgent")
.addPhoneNumber("+13125551234")
.build();
RcListBulkCapabilitiesResponse response = client.messaging().rcs().listBulkCapabilities(params);
```
Returns: `agent_id` (string), `agent_name` (string), `features` (array[string]), `phone_number` (string), `record_type` (enum: rcs.capabilities)
## Check RCS capabilities
`GET /messaging/rcs/capabilities/{agent_id}/{phone_number}`
```java
import com.telnyx.sdk.models.messaging.rcs.RcRetrieveCapabilitiesParams;
import com.telnyx.sdk.models.messaging.rcs.RcRetrieveCapabilitiesResponse;
RcRetrieveCapabilitiesParams params = RcRetrieveCapabilitiesParams.builder()
.agentId("550e8400-e29b-41d4-a716-446655440000")
.phoneNumber("+13125550001")
.build();
RcRetrieveCapabilit