Quick Start Guide¶
This guide will help you get started with TelcoAPI quickly.
Prerequisites¶
- Node.js 18 or later
- npm or yarn
- A TelcoAPI account and API key
Installation¶
Basic Setup¶
import { TelcoAPIClient } from '@telco-api/sdk';
const client = new TelcoAPIClient({
apiKey: 'your-api-key',
environment: 'sandbox' // or 'production'
});
Example: Managing SIM Cards¶
// Create a physical SIM profile
const simProfile = await client.sim.physical.create({
iccid: '89012345678901234567',
imsi: '123456789012345',
pin1: '1234',
pin2: '5678'
});
// Activate the SIM
await client.sim.physical.activate(simProfile.iccid);
// Create an eSIM profile
const esimProfile = await client.sim.esim.create({
eid: 'A1B2C3D4E5F6',
profileType: 'OPERATIONAL',
mno: 'your-operator-id'
});
// Generate activation code
const activationCode = await client.sim.esim.generateActivationCode(esimProfile.iccid);
Example: Diameter Protocol¶
// Set up a Diameter connection
const diameter = client.protocols.diameter.createConnection({
host: 'diameter.example.com',
port: 3868,
protocol: 'tcp'
});
// Send a Credit-Control-Request
const ccr = await diameter.sendCCR({
sessionId: 'session-123',
originHost: 'origin.example.com',
destinationRealm: 'example.com',
requestType: 'INITIAL_REQUEST'
});
Example: SS7 Protocol¶
// Set up SS7 connection
const ss7 = client.protocols.ss7.createConnection({
pointCode: '1-1-1',
networkIndicator: 'INTERNATIONAL'
});
// Send MAP message
const response = await ss7.map.sendMessage({
operationType: 'SEND_AUTHENTICATION_INFO',
imsi: '123456789012345'
});
Error Handling¶
try {
const profile = await client.sim.physical.activate('invalid-iccid');
} catch (error) {
if (error.code === 'INVALID_ICCID') {
console.error('Invalid ICCID provided');
} else if (error.code === 'NETWORK_ERROR') {
console.error('Network connection failed');
} else {
console.error('Unexpected error:', error);
}
}
Monitoring¶
// Set up monitoring
client.monitoring.configure({
metrics: ['api_calls', 'error_rate', 'latency'],
alertThreshold: {
errorRate: 0.01,
latency: 1000
}
});
// Get metrics
const metrics = await client.monitoring.getMetrics({
timeRange: '1h',
resolution: '1m'
});
Next Steps¶
- Read the full documentation
- Check out the examples
- Learn about security best practices
- Explore protocol implementations