Install in Claude Code
Copygit clone --depth 1 https://github.com/team-telnyx/ai /tmp/telnyx-10dlc-ruby && cp -r /tmp/telnyx-10dlc-ruby/providers/claude/plugin/skills/telnyx-10dlc-ruby ~/.claude/skills/telnyx-10dlc-rubyThen start a new Claude Code session; the skill loads automatically.
Definition
SKILL.md
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
# Telnyx 10DLC - Ruby
## Installation
```bash
gem install telnyx
```
## Setup
```ruby
require "telnyx"
client = Telnyx::Client.new(
api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)
```
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:
```ruby
telnyx_brand = client.messaging_10dlc.brand.create(
country: "US",
display_name: "ABC Mobile",
email: "support@example.com",
entity_type: :PRIVATE_PROFIT,
vertical: :TECHNOLOGY
)
puts(telnyx_brand)
```
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
- **Pagination:** Use `.auto_paging_each` for automatic iteration: `page.auto_paging_each { |item| puts item.id }`.
## Operational Caveats
- 10DLC is sequential: create the brand first, then submit the campaign, then attach messaging infrastructure such as the messaging profile.
- Registration calls are not enough by themselves. Messaging cannot use the campaign until the assignment step completes successfully.
- Treat registration status fields as part of the control flow. Do not assume the campaign is send-ready until the returned status fields confirm it.
## Reference Use Rules
Do not invent Telnyx parameters, enums, response fields, or webhook fields.
- If the parameter, enum, or response field you need is not shown inline in this skill, read [references/api-details.md](references/api-details.md) before writing code.
- Before using any operation in `## Additional Operations`, read [the optional-parameters section](references/api-details.md#optional-parameters) and [the response-schemas section](references/api-details.md#response-schemas).
- Before reading or matching webhook fields beyond the inline examples, read [the webhook payload reference](references/api-details.md#webhook-payload-fields).
## Core Tasks
### Create a brand
Brand registration is the entrypoint for any US A2P 10DLC campaign flow.
`client.messaging_10dlc.brand.create()` — `POST /10dlc/brand`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `entity_type` | object | Yes | Entity type behind the brand. |
| `display_name` | string | Yes | Display name, marketing name, or DBA name of the brand. |
| `country` | string | Yes | ISO2 2 characters country code. |
| `email` | string | Yes | Valid email address of brand support contact. |
| `vertical` | object | Yes | Vertical or industry segment of the brand. |
| `company_name` | string | No | (Required for Non-profit/private/public) Legal company name. |
| `first_name` | string | No | First name of business contact. |
| `last_name` | string | No | Last name of business contact. |
| ... | | | +16 optional params in [references/api-details.md](references/api-details.md) |
```ruby
telnyx_brand = client.messaging_10dlc.brand.create(
country: "US",
display_name: "ABC Mobile",
email: "support@example.com",
entity_type: :PRIVATE_PROFIT,
vertical: :TECHNOLOGY
)
puts(telnyx_brand)
```
Primary response fields:
- `telnyx_brand.brandId`
- `telnyx_brand.identityStatus`
- `telnyx_brand.status`
- `telnyx_brand.displayName`
- `telnyx_brand.state`
- `telnyx_brand.altBusinessId`
### Submit a campaign
Campaign submission is the compliance-critical step that determines whether traffic can be provisioned.
`client.messaging_10dlc.campaign_builder.submit()` — `POST /10dlc/campaignBuilder`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `brand_id` | string (UUID) | Yes | Alphanumeric identifier of the brand associated with this ca... |
| `description` | string | Yes | Summary description of this campaign. |
| `usecase` | string | Yes | Campaign usecase. |
| `age_gated` | boolean | No | Age gated message content in campaign. |
| `auto_renewal` | boolean | No | Campaign subscription auto-renewal option. |
| `direct_lending` | boolean | No | Direct lending or loan arrangement |
| ... | | | +29 optional params in [references/api-details.md](references/api-details.md) |
```ruby
telnyx_campaign_csp = client.messaging_10dlc.campaign_builder.submit(
brand_id: "BXXXXXX",
description: "Two-factor authentication messages",
usecase: "2FA"
sample_messages: ["Your verification code is {{code}}"],
)
puts(telnyx_campaign_csp)
```
Primary response fields:
- `telnyx_campaign_csp.campaignId`
- `telnyx_campaign_csp.brandId`
- `telnyx_campaign_csp.campaignStatus`
- `telnyx_campaign_csp.submissionStatus`
- `telnyx_campaign_csp.failureReasons`
- `telnyx_campaign_csp.status`
### Assign a messaging profile to a campaign
Messaging profile assignment is the practical handoff from registration to send-ready messaging infrastructure.
`client.messaging_10dlc.phone_number_assignment_by_profile.assign()` — `POST /10dlc/phoneNumberAssignmentByProfile`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `messaging_profile_id` | string (UUID) | Yes | The ID of the messaging profile that you want to link to the... |
| `campaign_id` | string (UUID) | Yes | The ID of the campaign you want to link to the specified mes... |
| `tcr_campaign_id` | string (UUID) | No | The TCR ID of the shared campaign you want to link to the sp... |
```ruby
response = client.messaging_10dlc.phone_number_assignment_by_profile.assign(
messaging_profile_id: "4001767e-ce0f-4cae-9d5f-0d5e636e7809"
campaign_id: "CXXX001",
)
puts(response)
```
Primary response fields:
- `response.messagingProfileId`
- `response.campaignId`
- `response.taskId`
- `response.tcrCampaignId`
---
### Webhook Verification
Telnyx signs web