Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Create and manage messaging profiles with number pools, sticky sender, and geomatch features. Configure short codes for high-volume messaging. This skill provides JavaScript SDK examples.
.claude/skills/team-telnyx-telnyx-messaging-profiles-javascript/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 121% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 272% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 188% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 219% | 0% |
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
bashnpm install telnyx@6.74.2
javascriptimport Telnyx from 'telnyx'; const client = new Telnyx({ apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted });
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:
javascripttry { const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' }); } catch (err) { if (err instanceof Telnyx.APIConnectionError) { console.error('Network error — check connectivity and retry'); } else if (err instanceof Telnyx.RateLimitError) { // 429: rate limited — wait and retry with exponential backoff const retryAfter = err.headers?.['retry-after'] || 1; await new Promise(r => setTimeout(r, retryAfter * 1000)); } else if (err instanceof Telnyx.APIError) { console.error(`API error ${err.status}: ${err.message}`); if (err.status === 422) { console.error('Validation error — check required fields and formats'); } } }
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).
for await (const item of result) { ... } to iterate through all pages automatically.GET /messaging_profiles
javascript// Automatically fetches more pages as needed. for await (const messagingProfile of client.messagingProfiles.list()) { console.log(messagingProfile.id); }
Returns: ai_assistant_id (string | null), alpha_sender (string | null), created_at (date-time), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), health_webhook_url (url), id (uuid), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), name (string), number_pool_settings (object | null), organization_id (string), record_type (enum: messaging_profile), redaction_enabled (boolean), redaction_level (integer), resource_group_id (string | null), smart_encoding (boolean), updated_at (date-time), url_shortener_settings (object | null), v1_secret (string), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url), whitelisted_destinations (arraystring])
POST /messaging_profiles — Required: name, whitelisted_destinations
Optional: ai_assistant_id (string | null), alpha_sender (string | null), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), health_webhook_url (url), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), number_pool_settings (object | null), resource_group_id (string | null), smart_encoding (boolean), url_shortener_settings (object | null), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url)
javascriptconst messagingProfile = await client.messagingProfiles.create({ name: 'My name', whitelisted_destinations: ['US'], }); console.log(messagingProfile.data);
Returns: ai_assistant_id (string | null), alpha_sender (string | null), created_at (date-time), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), health_webhook_url (url), id (uuid), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), name (string), number_pool_settings (object | null), organization_id (string), record_type (enum: messaging_profile), redaction_enabled (boolean), redaction_level (integer), resource_group_id (string | null), smart_encoding (boolean), updated_at (date-time), url_shortener_settings (object | null), v1_secret (string), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url), whitelisted_destinations (arraystring])
GET /messaging_profiles/{id}
javascriptconst messagingProfile = await client.messagingProfiles.retrieve( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(messagingProfile.data);
Returns: ai_assistant_id (string | null), alpha_sender (string | null), created_at (date-time), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), health_webhook_url (url), id (uuid), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), name (string), number_pool_settings (object | null), organization_id (string), record_type (enum: messaging_profile), redaction_enabled (boolean), redaction_level (integer), resource_group_id (string | null), smart_encoding (boolean), updated_at (date-time), url_shortener_settings (object | null), v1_secret (string), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url), whitelisted_destinations (arraystring])
PATCH /messaging_profiles/{id}
Optional: ai_assistant_id (string | null), alpha_sender (string | null), created_at (date-time), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), id (uuid), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), name (string), number_pool_settings (object | null), record_type (enum: messaging_profile), smart_encoding (boolean), updated_at (date-time), url_shortener_settings (object | null), v1_secret (string), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url), whitelisted_destinations (arraystring])
javascriptconst messagingProfile = await client.messagingProfiles.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(messagingProfile.data);
Returns: ai_assistant_id (string | null), alpha_sender (string | null), created_at (date-time), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), health_webhook_url (url), id (uuid), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), name (string), number_pool_settings (object | null), organization_id (string), record_type (enum: messaging_profile), redaction_enabled (boolean), redaction_level (integer), resource_group_id (string | null), smart_encoding (boolean), updated_at (date-time), url_shortener_settings (object | null), v1_secret (string), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url), whitelisted_destinations (arraystring])
DELETE /messaging_profiles/{id}
javascriptconst messagingProfile = await client.messagingProfiles.delete( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(messagingProfile.data);
Returns: ai_assistant_id (string | null), alpha_sender (string | null), created_at (date-time), daily_spend_limit (string), daily_spend_limit_enabled (boolean), enabled (boolean), health_webhook_url (url), id (uuid), mms_fall_back_to_sms (boolean), mms_transcoding (boolean), mobile_only (boolean), name (string), number_pool_settings (object | null), organization_id (string), record_type (enum: messaging_profile), redaction_enabled (boolean), redaction_level (integer), resource_group_id (string | null), smart_encoding (boolean), updated_at (date-time), url_shortener_settings (object | null), v1_secret (string), webhook_api_version (enum: 1, 2, 2010-04-01), webhook_failover_url (url), webhook_url (url), whitelisted_destinations (arraystring])
GET /messaging_profiles/{id}/phone_numbers
javascript// Automatically fetches more pages as needed. for await (const phoneNumberWithMessagingSettings of client.messagingProfiles.listPhoneNumbers( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', )) { console.log(phoneNumberWithMessagingSettings.id); }
Returns: country_code (string), created_at (date-time), eligible_messaging_products (arraystring]), features (object), health (object), id (string), messaging_product (string), messaging_profile_id (string | null), organization_id (string), phone_number (string), record_type (enum: messaging_phone_number, messaging_settings), tags (arraystring]), traffic_type (string), type (enum: long-code, toll-free, short-code, longcode, tollfree, shortcode), updated_at (date-time)
GET /messaging_profiles/{id}/short_codes
javascript// Automatically fetches more pages as needed. for await (const shortCode of client.messagingProfiles.listShortCodes( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', )) { console.log(shortCode.messaging_profile_id); }
Returns: country_code (string), created_at (date-time), id (uuid), messaging_profile_id (string | null), record_type (enum: short_code), short_code (string), tags (array), updated_at (date-time)
GET /short_codes
javascript// Automatically fetches more pages as needed. for await (const shortCode of client.shortCodes.list()) { console.log(shortCode.messaging_profile_id); }
Returns: country_code (string), created_at (date-time), id (uuid), messaging_profile_id (string | null), record_type (enum: short_code), short_code (string), tags (array), updated_at (date-time)
GET /short_codes/{id}
javascriptconst shortCode = await client.shortCodes.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(shortCode.data);
Returns: country_code (string), created_at (date-time), id (uuid), messaging_profile_id (string | null), record_type (enum: short_code), short_code (string), tags (array), updated_at (date-time)
Update the settings for a specific short code. To unbind a short code from a profile, set the messaging_profile_id to null or an empty string. To add or update tags, include the tags field as an array of strings.
PATCH /short_codes/{id} — Required: messaging_profile_id
Optional: tags (array)
javascriptconst shortCode = await client.shortCodes.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { messaging_profile_id: 'abc85f64-5717-4562-b3fc-2c9600000000', }); console.log(shortCode.data);
Returns: country_code (string), created_at (date-time), id (uuid), messaging_profile_id (string | null), record_type (enum: short_code), short_code (string), tags (array), updated_at (date-time)
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 11,750 | 6,964 | -41% | 1 | 1 | 0% | 2,338 | 5,160 | +121% | 0 | 0 | — |
case-02 | fail→pass | 15,648 | 6,429 | -59% | 1 | 1 | 0% | 3,097 | 4,959 | +60% | 0 | 0 | — |
case-03 | fail→pass | 6,543 | 5,153 | -21% | 1 | 1 | 0% | 1,272 | 4,728 | +272% | 0 | 0 | — |
case-04 | fail→pass | 8,029 | 4,471 | -44% | 1 | 1 | 0% | 1,598 | 4,597 | +188% | 0 | 0 | — |
case-18 | fail→pass | 6,215 | 1,763 | -72% | 1 | 1 | 0% | 1,256 | 4,003 | +219% | 0 | 0 | — |
case-05 | pass→pass | 7,248 | 3,203 | -56% | 1 | 1 | 0% | 1,437 | 4,310 | +200% | 0 | 0 | — |
case-06 | pass→pass | 5,138 | 2,737 | -47% | 1 | 1 | 0% | 1,009 | 4,146 | +311% | 0 | 0 | — |
case-07 | pass→pass | 6,284 | 2,618 | -58% | 1 | 1 | 0% | 1,322 | 4,254 | +222% | 0 | 0 | — |
case-08 | fail→pass | 9,422 | 4,234 | -55% | 1 | 1 | 0% | 1,937 | 4,582 | +137% | 0 | 0 | — |
case-19 | pass→pass | 8,116 | 3,974 | -51% | 1 | 1 | 0% | 1,590 | 4,539 | +185% | 0 | 0 | — |
case-09 | fail→pass | 9,059 | 5,421 | -40% | 1 | 1 | 0% | 1,753 | 4,831 | +176% | 0 | 0 | — |
case-10 | pass→pass | 5,358 | 3,689 | -31% | 1 | 1 | 0% | 1,125 | 4,493 | +299% | 0 | 0 | — |
case-11 | pass→pass | 5,324 | 3,362 | -37% | 1 | 1 | 0% | 1,093 | 4,375 | +300% | 0 | 0 | — |
case-12 | fail→pass | 11,649 | 6,123 | -47% | 1 | 1 | 0% | 2,218 | 4,837 | +118% | 0 | 0 | — |
case-13 | fail→pass | 10,395 | 5,039 | -52% | 1 | 1 | 0% | 1,892 | 4,680 | +147% | 0 | 0 | — |
case-14 | fail→pass | 11,724 | 2,865 | -76% | 1 | 1 | 0% | 2,116 | 4,251 | +101% | 0 | 0 | — |
case-15 | pass→pass | 6,440 | 3,388 | -47% | 1 | 1 | 0% | 1,287 | 4,380 | +240% | 0 | 0 | — |
case-16 | pass→pass | 4,282 | 1,577 | -63% | 1 | 1 | 0% | 748 | 3,971 | +431% | 0 | 0 | — |
case-17 | pass→pass | 4,653 | 4,091 | -12% | 1 | 1 | 0% | 860 | 4,556 | +430% | 0 | 0 | — |
case-20 | fail→pass | 4,400 | 3,386 | -23% | 1 | 1 | 0% | 966 | 4,416 | +357% | 0 | 0 | — |
case-21 | pass→pass | 7,012 | 5,059 | -28% | 1 | 1 | 0% | 1,416 | 4,685 | +231% | 0 | 0 | — |
case-22 | pass→pass | 11,083 | 10,285 | -7% | 1 | 1 | 0% | 2,059 | 5,706 | +177% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +50 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.