Skip to main content
telnyx-networking-javascript Configure private networks, WireGuard VPN gateways, internet gateways, and virtual cross connects. This skill provides JavaScript SDK examples.
インストールへ移動 Skills Marketplace コミュニティが作成したAIスキルを発見・探索
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/team-telnyx/telnyx-toolkit --skill telnyx-networking-javascriptコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Zipをダウンロード ダウンロード中... SOC
name telnyx-networking-javascript description Configure private networks, WireGuard VPN gateways, internet gateways, and virtual cross connects. This skill provides JavaScript SDK examples. metadata {"author":"telnyx","product":"networking","language":"javascript","generated_by":"telnyx-ext-skills-generator"}
Telnyx Networking - JavaScript
Installation
npm install telnyx
Setup
import Telnyx from 'telnyx' ;
const client = new Telnyx ({
apiKey : process.env ['TELNYX_API_KEY' ],
});
All examples below assume client is already initialized as shown above.
List all Regions
List all regions and the interfaces that region supports
GET /regions
const regions = await client.regions .list ();
console .log (regions.data );
List all Networks
for await (const networkListResponse of client.networks .list ()) {
console .log (networkListResponse);
}
Create a Network const network = await client.networks .create ({ name : 'test network' });
console .log (network.data );
Retrieve a Network const network = await client.networks .retrieve ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (network.data );
Update a Network const network = await client.networks .update ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' , {
name : 'test network' ,
});
console .log (network.data );
Delete a Network const network = await client.networks .delete ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (network.data );
Get Default Gateway status. GET /networks/{id}/default_gateway
const defaultGateway = await client.networks .defaultGateway .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (defaultGateway.data );
Create Default Gateway. POST /networks/{id}/default_gateway
const defaultGateway = await client.networks .defaultGateway .create (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (defaultGateway.data );
Delete Default Gateway. DELETE /networks/{id}/default_gateway
const defaultGateway = await client.networks .defaultGateway .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (defaultGateway.data );
List all Interfaces for a Network. GET /networks/{id}/network_interfaces
for await (const networkListInterfacesResponse of client.networks .listInterfaces (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
)) {
console .log (networkListInterfacesResponse);
}
List all WireGuard Interfaces List all WireGuard Interfaces.
GET /wireguard_interfaces
for await (const wireguardInterfaceListResponse of client.wireguardInterfaces .list ()) {
console .log (wireguardInterfaceListResponse);
}
Create a WireGuard Interface Create a new WireGuard Interface.
POST /wireguard_interfaces
const wireguardInterface = await client.wireguardInterfaces .create ({ region_code : 'ashburn-va' });
console .log (wireguardInterface.data );
Retrieve a WireGuard Interfaces Retrieve a WireGuard Interfaces.
GET /wireguard_interfaces/{id}
const wireguardInterface = await client.wireguardInterfaces .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (wireguardInterface.data );
Delete a WireGuard Interface Delete a WireGuard Interface.
DELETE /wireguard_interfaces/{id}
const wireguardInterface = await client.wireguardInterfaces .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (wireguardInterface.data );
List all WireGuard Peers List all WireGuard peers.
for await (const wireguardPeerListResponse of client.wireguardPeers .list ()) {
console .log (wireguardPeerListResponse);
}
Create a WireGuard Peer Create a new WireGuard Peer.
const wireguardPeer = await client.wireguardPeers .create ({
wireguard_interface_id : '6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
});
console .log (wireguardPeer.data );
Retrieve the WireGuard Peer Retrieve the WireGuard peer.
GET /wireguard_peers/{id}
const wireguardPeer = await client.wireguardPeers .retrieve ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (wireguardPeer.data );
Update the WireGuard Peer Update the WireGuard peer.
PATCH /wireguard_peers/{id}
const wireguardPeer = await client.wireguardPeers .update ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (wireguardPeer.data );
Delete the WireGuard Peer Delete the WireGuard peer.
DELETE /wireguard_peers/{id}
const wireguardPeer = await client.wireguardPeers .delete ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (wireguardPeer.data );
Retrieve Wireguard config template for Peer GET /wireguard_peers/{id}/config
const response = await client.wireguardPeers .retrieveConfig ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (response);
Get all Private Wireless Gateways Get all Private Wireless Gateways belonging to the user.
GET /private_wireless_gateways
for await (const privateWirelessGateway of client.privateWirelessGateways .list ()) {
console .log (privateWirelessGateway.id );
}
Create a Private Wireless Gateway Asynchronously create a Private Wireless Gateway for SIM cards for a previously created network.
POST /private_wireless_gateways — Required: network_id, name
const privateWirelessGateway = await client.privateWirelessGateways .create ({
name : 'My private wireless gateway' ,
network_id : '6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
});
console .log (privateWirelessGateway.data );
Get a Private Wireless Gateway Retrieve information about a Private Wireless Gateway.
GET /private_wireless_gateways/{id}
const privateWirelessGateway = await client.privateWirelessGateways .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (privateWirelessGateway.data );
Delete a Private Wireless Gateway Deletes the Private Wireless Gateway.
DELETE /private_wireless_gateways/{id}
const privateWirelessGateway = await client.privateWirelessGateways .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (privateWirelessGateway.data );
List all Public Internet Gateways List all Public Internet Gateways.
GET /public_internet_gateways
for await (const publicInternetGatewayListResponse of client.publicInternetGateways .list ()) {
console .log (publicInternetGatewayListResponse);
}
Create a Public Internet Gateway Create a new Public Internet Gateway.
POST /public_internet_gateways
const publicInternetGateway = await client.publicInternetGateways .create ();
console .log (publicInternetGateway.data );
Retrieve a Public Internet Gateway Retrieve a Public Internet Gateway.
GET /public_internet_gateways/{id}
const publicInternetGateway = await client.publicInternetGateways .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (publicInternetGateway.data );
Delete a Public Internet Gateway Delete a Public Internet Gateway.
DELETE /public_internet_gateways/{id}
const publicInternetGateway = await client.publicInternetGateways .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (publicInternetGateway.data );
List all Virtual Cross Connects List all Virtual Cross Connects.
GET /virtual_cross_connects
for await (const virtualCrossConnectListResponse of client.virtualCrossConnects .list ()) {
console .log (virtualCrossConnectListResponse);
}
Create a Virtual Cross Connect Create a new Virtual Cross Connect. For AWS and GCE, you have the option of creating the primary connection first and the secondary connection later.
POST /virtual_cross_connects
const virtualCrossConnect = await client.virtualCrossConnects .create ({ region_code : 'ashburn-va' });
console .log (virtualCrossConnect.data );
Retrieve a Virtual Cross Connect Retrieve a Virtual Cross Connect.
GET /virtual_cross_connects/{id}
const virtualCrossConnect = await client.virtualCrossConnects .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (virtualCrossConnect.data );
Update the Virtual Cross Connect Update the Virtual Cross Connect. Cloud IPs can only be patched during the created state, as GCE will only inform you of your generated IP once the pending connection requested has bee...
PATCH /virtual_cross_connects/{id}
const virtualCrossConnect = await client.virtualCrossConnects .update (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (virtualCrossConnect.data );
Delete a Virtual Cross Connect Delete a Virtual Cross Connect.
DELETE /virtual_cross_connects/{id}
const virtualCrossConnect = await client.virtualCrossConnects .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (virtualCrossConnect.data );
List Virtual Cross Connect Cloud Coverage List Virtual Cross Connects Cloud Coverage. This endpoint shows which cloud regions are available for the location_code your Virtual Cross Connect will be provisioned in.
GET /virtual_cross_connects/coverage
for await (const virtualCrossConnectsCoverageListResponse of client.virtualCrossConnectsCoverage .list ()) {
console .log (virtualCrossConnectsCoverageListResponse.available_bandwidth );
}
List all Global IPs
for await (const globalIPListResponse of client.globalIPs .list ()) {
console .log (globalIPListResponse);
}
Create a Global IP const globalIP = await client.globalIPs .create ();
console .log (globalIP.data );
Retrieve a Global IP const globalIP = await client.globalIPs .retrieve ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (globalIP.data );
Delete a Global IP const globalIP = await client.globalIPs .delete ('6a09cdc3-8948-47f0-aa62-74ac943d6c58' );
console .log (globalIP.data );
List all Global IP Allowed Ports GET /global_ip_allowed_ports
const globalIPAllowedPorts = await client.globalIPAllowedPorts .list ();
console .log (globalIPAllowedPorts.data );
Global IP Assignment Health Check Metrics GET /global_ip_assignment_health
const globalIPAssignmentHealth = await client.globalIPAssignmentHealth .retrieve ();
console .log (globalIPAssignmentHealth.data );
List all Global IP assignments List all Global IP assignments.
GET /global_ip_assignments
for await (const globalIPAssignment of client.globalIPAssignments .list ()) {
console .log (globalIPAssignment.id );
}
Create a Global IP assignment Create a Global IP assignment.
POST /global_ip_assignments
const globalIPAssignment = await client.globalIPAssignments .create ();
console .log (globalIPAssignment.data );
Retrieve a Global IP Retrieve a Global IP assignment.
GET /global_ip_assignments/{id}
const globalIPAssignment = await client.globalIPAssignments .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (globalIPAssignment.data );
Update a Global IP assignment Update a Global IP assignment.
PATCH /global_ip_assignments/{id}
const globalIPAssignment = await client.globalIPAssignments .update (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
{ globalIpAssignmentUpdateRequest : {} },
);
console .log (globalIPAssignment.data );
Delete a Global IP assignment Delete a Global IP assignment.
DELETE /global_ip_assignments/{id}
const globalIPAssignment = await client.globalIPAssignments .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (globalIPAssignment.data );
Global IP Assignment Usage Metrics GET /global_ip_assignments/usage
const globalIPAssignmentsUsage = await client.globalIPAssignmentsUsage .retrieve ();
console .log (globalIPAssignmentsUsage.data );
List all Global IP Health check types List all Global IP Health check types.
GET /global_ip_health_check_types
const globalIPHealthCheckTypes = await client.globalIPHealthCheckTypes .list ();
console .log (globalIPHealthCheckTypes.data );
List all Global IP health checks List all Global IP health checks.
GET /global_ip_health_checks
for await (const globalIPHealthCheckListResponse of client.globalIPHealthChecks .list ()) {
console .log (globalIPHealthCheckListResponse);
}
Create a Global IP health check Create a Global IP health check.
POST /global_ip_health_checks
const globalIPHealthCheck = await client.globalIPHealthChecks .create ();
console .log (globalIPHealthCheck.data );
Retrieve a Global IP health check Retrieve a Global IP health check.
GET /global_ip_health_checks/{id}
const globalIPHealthCheck = await client.globalIPHealthChecks .retrieve (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (globalIPHealthCheck.data );
Delete a Global IP health check Delete a Global IP health check.
DELETE /global_ip_health_checks/{id}
const globalIPHealthCheck = await client.globalIPHealthChecks .delete (
'6a09cdc3-8948-47f0-aa62-74ac943d6c58' ,
);
console .log (globalIPHealthCheck.data );
Global IP Latency Metrics const globalIPLatency = await client.globalIPLatency .retrieve ();
console .log (globalIPLatency.data );
List all Global IP Protocols const globalIPProtocols = await client.globalIPProtocols .list ();
console .log (globalIPProtocols.data );
Global IP Usage Metrics const globalIPUsage = await client.globalIPUsage .retrieve ();
console .log (globalIPUsage.data );