Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Create and manage Telnyx Missions — automated workflows, tasks, and sub-resources for AI-driven telecom operations. This skill provides JavaScript SDK examples.
.claude/skills/team-telnyx-telnyx-missions-javascript/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 303% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 441% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 250% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 600% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 371% | 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.List all missions for the organization
GET /ai/missions
javascript// Automatically fetches more pages as needed. for await (const missionData of client.ai.missions.list()) { console.log(missionData.mission_id); }
Returns: created_at (date-time), description (string), execution_mode (enum: external, managed), instructions (string), metadata (object), mission_id (uuid), model (string), name (string), updated_at (date-time)
Create a new mission definition
POST /ai/missions — Required: name
Optional: description (string), execution_mode (enum: external, managed), instructions (string), metadata (object), model (string)
javascriptconst mission = await client.ai.missions.create({ name: 'my-resource' }); console.log(mission.data);
Returns: created_at (date-time), description (string), execution_mode (enum: external, managed), instructions (string), metadata (object), mission_id (uuid), model (string), name (string), updated_at (date-time)
List recent events across all missions
GET /ai/missions/events
javascript// Automatically fetches more pages as needed. for await (const eventData of client.ai.missions.listEvents()) { console.log(eventData.event_id); }
Returns: agent_id (string), event_id (string), idempotency_key (string), payload (object), run_id (string), step_id (string), summary (string), timestamp (date-time), type (enum: status_change, step_started, step_completed, step_failed, tool_call, tool_result, message, error, custom)
List recent runs across all missions
GET /ai/missions/runs
javascript// Automatically fetches more pages as needed. for await (const missionRunData of client.ai.missions.runs.listRuns()) { console.log(missionRunData.mission_id); }
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
Get a mission by ID (includes tools, knowledge_bases, mcp_servers)
GET /ai/missions/{mission_id}
javascriptconst mission = await client.ai.missions.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(mission.data);
Returns: created_at (date-time), description (string), execution_mode (enum: external, managed), instructions (string), metadata (object), mission_id (uuid), model (string), name (string), updated_at (date-time)
Update a mission definition
PUT /ai/missions/{mission_id}
Optional: description (string), execution_mode (enum: external, managed), instructions (string), metadata (object), model (string), name (string)
javascriptconst response = await client.ai.missions.updateMission('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(response.data);
Returns: created_at (date-time), description (string), execution_mode (enum: external, managed), instructions (string), metadata (object), mission_id (uuid), model (string), name (string), updated_at (date-time)
Delete a mission
DELETE /ai/missions/{mission_id}
javascriptawait client.ai.missions.deleteMission('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
Clone an existing mission
POST /ai/missions/{mission_id}/clone
javascriptconst response = await client.ai.missions.cloneMission('mission_id'); console.log(response);
List all knowledge bases for a mission
GET /ai/missions/{mission_id}/knowledge-bases
javascriptconst response = await client.ai.missions.knowledgeBases.listKnowledgeBases('mission_id'); console.log(response);
Create a new knowledge base for a mission
POST /ai/missions/{mission_id}/knowledge-bases
javascriptconst response = await client.ai.missions.knowledgeBases.createKnowledgeBase('mission_id'); console.log(response);
Get a specific knowledge base by ID
GET /ai/missions/{mission_id}/knowledge-bases/{knowledge_base_id}
javascriptconst response = await client.ai.missions.knowledgeBases.getKnowledgeBase('knowledge_base_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000', }); console.log(response);
Update a knowledge base definition
PUT /ai/missions/{mission_id}/knowledge-bases/{knowledge_base_id}
javascriptconst response = await client.ai.missions.knowledgeBases.updateKnowledgeBase('knowledge_base_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000', }); console.log(response);
Delete a knowledge base from a mission
DELETE /ai/missions/{mission_id}/knowledge-bases/{knowledge_base_id}
javascriptawait client.ai.missions.knowledgeBases.deleteKnowledgeBase('knowledge_base_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000', });
List all MCP servers for a mission
GET /ai/missions/{mission_id}/mcp-servers
javascriptconst response = await client.ai.missions.mcpServers.listMcpServers('mission_id'); console.log(response);
Create a new MCP server for a mission
POST /ai/missions/{mission_id}/mcp-servers
javascriptconst response = await client.ai.missions.mcpServers.createMcpServer('mission_id'); console.log(response);
Get a specific MCP server by ID
GET /ai/missions/{mission_id}/mcp-servers/{mcp_server_id}
javascriptconst response = await client.ai.missions.mcpServers.getMcpServer('mcp_server_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000', }); console.log(response);
Update an MCP server definition
PUT /ai/missions/{mission_id}/mcp-servers/{mcp_server_id}
javascriptconst response = await client.ai.missions.mcpServers.updateMcpServer('mcp_server_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000', }); console.log(response);
Delete an MCP server from a mission
DELETE /ai/missions/{mission_id}/mcp-servers/{mcp_server_id}
javascriptawait client.ai.missions.mcpServers.deleteMcpServer('mcp_server_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000' });
List all runs for a specific mission
GET /ai/missions/{mission_id}/runs
javascript// Automatically fetches more pages as needed. for await (const missionRunData of client.ai.missions.runs.list( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', )) { console.log(missionRunData.mission_id); }
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
Start a new run for a mission
POST /ai/missions/{mission_id}/runs
Optional: input (object), metadata (object)
javascriptconst run = await client.ai.missions.runs.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(run.data);
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
Get details of a specific run
GET /ai/missions/{mission_id}/runs/{run_id}
javascriptconst run = await client.ai.missions.runs.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(run.data);
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
Update run status and/or result
PATCH /ai/missions/{mission_id}/runs/{run_id}
Optional: error (string), metadata (object), result_payload (object), result_summary (string), status (enum: pending, running, paused, succeeded, failed, cancelled)
javascriptconst run = await client.ai.missions.runs.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(run.data);
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
Cancel a running or paused run
POST /ai/missions/{mission_id}/runs/{run_id}/cancel
javascriptconst response = await client.ai.missions.runs.cancelRun('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(response.data);
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
List events for a run (paginated)
GET /ai/missions/{mission_id}/runs/{run_id}/events
javascript// Automatically fetches more pages as needed. for await (const eventData of client.ai.missions.runs.events.list( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }, )) { console.log(eventData.event_id); }
Returns: agent_id (string), event_id (string), idempotency_key (string), payload (object), run_id (string), step_id (string), summary (string), timestamp (date-time), type (enum: status_change, step_started, step_completed, step_failed, tool_call, tool_result, message, error, custom)
Log an event for a run
POST /ai/missions/{mission_id}/runs/{run_id}/events — Required: type, summary
Optional: agent_id (string), idempotency_key (string), payload (object), step_id (string)
javascriptconst response = await client.ai.missions.runs.events.log('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', summary: 'Brief task summary', type: 'status_change', }); console.log(response.data);
Returns: agent_id (string), event_id (string), idempotency_key (string), payload (object), run_id (string), step_id (string), summary (string), timestamp (date-time), type (enum: status_change, step_started, step_completed, step_failed, tool_call, tool_result, message, error, custom)
Get details of a specific event
GET /ai/missions/{mission_id}/runs/{run_id}/events/{event_id}
javascriptconst response = await client.ai.missions.runs.events.getEventDetails('event_id', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', run_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(response.data);
Returns: agent_id (string), event_id (string), idempotency_key (string), payload (object), run_id (string), step_id (string), summary (string), timestamp (date-time), type (enum: status_change, step_started, step_completed, step_failed, tool_call, tool_result, message, error, custom)
Pause a running run
POST /ai/missions/{mission_id}/runs/{run_id}/pause
javascriptconst response = await client.ai.missions.runs.pauseRun('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(response.data);
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
Get the plan (all steps) for a run
GET /ai/missions/{mission_id}/runs/{run_id}/plan
javascriptconst plan = await client.ai.missions.runs.plan.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(plan.data);
Returns: completed_at (date-time), description (string), metadata (object), parent_step_id (string), run_id (uuid), sequence (integer), started_at (date-time), status (enum: pending, in_progress, completed, skipped, failed), step_id (string)
Create the initial plan for a run
POST /ai/missions/{mission_id}/runs/{run_id}/plan — Required: steps
javascriptconst plan = await client.ai.missions.runs.plan.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', steps: [ { description: 'description', sequence: 0, step_id: '550e8400-e29b-41d4-a716-446655440000', }, ], }); console.log(plan.data);
Returns: completed_at (date-time), description (string), metadata (object), parent_step_id (string), run_id (uuid), sequence (integer), started_at (date-time), status (enum: pending, in_progress, completed, skipped, failed), step_id (string)
Add one or more steps to an existing plan
POST /ai/missions/{mission_id}/runs/{run_id}/plan/steps — Required: steps
javascriptconst response = await client.ai.missions.runs.plan.addStepsToPlan( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', steps: [ { description: 'description', sequence: 0, step_id: '550e8400-e29b-41d4-a716-446655440000', }, ], }, ); console.log(response.data);
Returns: completed_at (date-time), description (string), metadata (object), parent_step_id (string), run_id (uuid), sequence (integer), started_at (date-time), status (enum: pending, in_progress, completed, skipped, failed), step_id (string)
Get details of a specific plan step
GET /ai/missions/{mission_id}/runs/{run_id}/plan/steps/{step_id}
javascriptconst response = await client.ai.missions.runs.plan.getStepDetails('step_id', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', run_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(response.data);
Returns: completed_at (date-time), description (string), metadata (object), parent_step_id (string), run_id (uuid), sequence (integer), started_at (date-time), status (enum: pending, in_progress, completed, skipped, failed), step_id (string)
Update the status of a plan step
PATCH /ai/missions/{mission_id}/runs/{run_id}/plan/steps/{step_id}
Optional: metadata (object), status (enum: pending, in_progress, completed, skipped, failed)
javascriptconst response = await client.ai.missions.runs.plan.updateStep('step_id', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', run_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(response.data);
Returns: completed_at (date-time), description (string), metadata (object), parent_step_id (string), run_id (uuid), sequence (integer), started_at (date-time), status (enum: pending, in_progress, completed, skipped, failed), step_id (string)
Resume a paused run
POST /ai/missions/{mission_id}/runs/{run_id}/resume
javascriptconst response = await client.ai.missions.runs.resumeRun('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(response.data);
Returns: error (string), finished_at (date-time), input (object), metadata (object), mission_id (uuid), result_payload (object), result_summary (string), run_id (uuid), started_at (date-time), status (enum: pending, running, paused, succeeded, failed, cancelled), updated_at (date-time)
List all Telnyx agents linked to a run
GET /ai/missions/{mission_id}/runs/{run_id}/telnyx-agents
javascriptconst telnyxAgents = await client.ai.missions.runs.telnyxAgents.list( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }, ); console.log(telnyxAgents.data);
Returns: created_at (date-time), run_id (string), telnyx_agent_id (string)
Link a Telnyx AI agent (voice/messaging) to a run
POST /ai/missions/{mission_id}/runs/{run_id}/telnyx-agents — Required: telnyx_agent_id
javascriptconst response = await client.ai.missions.runs.telnyxAgents.link( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', telnyx_agent_id: '550e8400-e29b-41d4-a716-446655440000' }, ); console.log(response.data);
Returns: created_at (date-time), run_id (string), telnyx_agent_id (string)
Unlink a Telnyx agent from a run
DELETE /ai/missions/{mission_id}/runs/{run_id}/telnyx-agents/{telnyx_agent_id}
javascriptawait client.ai.missions.runs.telnyxAgents.unlink('telnyx_agent_id', { mission_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', run_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', });
List all tools for a mission
GET /ai/missions/{mission_id}/tools
javascriptconst response = await client.ai.missions.tools.listTools('mission_id'); console.log(response);
Create a new tool for a mission
POST /ai/missions/{mission_id}/tools
javascriptconst response = await client.ai.missions.tools.createTool('mission_id'); console.log(response);
Get a specific tool by ID
GET /ai/missions/{mission_id}/tools/{tool_id}
javascriptconst response = await client.ai.missions.tools.getTool('tool_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000' }); console.log(response);
Update a tool definition
PUT /ai/missions/{mission_id}/tools/{tool_id}
javascriptconst response = await client.ai.missions.tools.updateTool('tool_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000' }); console.log(response);
Delete a tool from a mission
DELETE /ai/missions/{mission_id}/tools/{tool_id}
javascriptawait client.ai.missions.tools.deleteTool('tool_id', { mission_id: '550e8400-e29b-41d4-a716-446655440000' });
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-22 | pass→pass | 11,563 | 11,917 | +3% | 1 | 1 | 0% | 2,314 | 9,827 | +325% | 0 | 0 | — |
case-01 | fail→pass | 12,504 | 10,407 | -17% | 1 | 1 | 0% | 2,393 | 9,637 | +303% | 0 | 0 | — |
case-02 | fail→pass | 8,706 | 5,226 | -40% | 1 | 1 | 0% | 1,570 | 8,490 | +441% | 0 | 0 | — |
case-03 | fail→pass | 14,139 | 6,332 | -55% | 1 | 1 | 0% | 2,504 | 8,756 | +250% | 0 | 0 | — |
case-04 | pass→pass | 8,088 | 4,995 | -38% | 1 | 1 | 0% | 1,565 | 8,350 | +434% | 0 | 0 | — |
case-05 | fail→pass | 6,237 | 3,727 | -40% | 1 | 1 | 0% | 1,166 | 8,164 | +600% | 0 | 0 | — |
case-06 | fail→pass | 9,211 | 3,029 | -67% | 1 | 1 | 0% | 1,692 | 7,969 | +371% | 0 | 0 | — |
case-07 | fail→pass | 9,571 | 3,760 | -61% | 1 | 1 | 0% | 1,916 | 8,197 | +328% | 0 | 0 | — |
case-08 | fail→pass | 9,645 | 4,210 | -56% | 1 | 1 | 0% | 1,768 | 8,270 | +368% | 0 | 0 | — |
case-09 | fail→pass | 10,201 | 3,048 | -70% | 1 | 1 | 0% | 1,892 | 7,971 | +321% | 0 | 0 | — |
case-10 | fail→pass | 8,486 | 3,441 | -59% | 1 | 1 | 0% | 1,556 | 8,079 | +419% | 0 | 0 | — |
case-11 | fail→pass | 7,171 | 4,173 | -42% | 1 | 1 | 0% | 1,477 | 8,364 | +466% | 0 | 0 | — |
case-12 | fail→pass | 7,542 | 2,664 | -65% | 1 | 1 | 0% | 1,410 | 7,899 | +460% | 0 | 0 | — |
case-13 | fail→pass | 10,193 | 4,918 | -52% | 1 | 1 | 0% | 1,988 | 8,539 | +330% | 0 | 0 | — |
case-14 | fail→pass | 9,248 | 5,044 | -45% | 1 | 1 | 0% | 1,854 | 8,574 | +362% | 0 | 0 | — |
case-15 | fail→pass | 8,527 | 4,718 | -45% | 1 | 1 | 0% | 1,747 | 8,471 | +385% | 0 | 0 | — |
case-16 | fail→pass | 10,756 | 4,700 | -56% | 1 | 1 | 0% | 2,302 | 8,471 | +268% | 0 | 0 | — |
case-17 | fail→pass | 5,735 | 2,780 | -52% | 1 | 1 | 0% | 1,123 | 7,992 | +612% | 0 | 0 | — |
case-18 | fail→pass | 10,902 | 5,578 | -49% | 1 | 1 | 0% | 1,965 | 8,559 | +336% | 0 | 0 | — |
case-19 | fail→pass | 11,827 | 3,582 | -70% | 1 | 1 | 0% | 2,354 | 8,188 | +248% | 0 | 0 | — |
case-20 | fail→pass | 4,806 | 4,586 | -5% | 1 | 1 | 0% | 966 | 8,400 | +770% | 0 | 0 | — |
case-21 | pass→pass | 9,649 | 5,535 | -43% | 1 | 1 | 0% | 1,875 | 8,503 | +353% | 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 +86 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.