@telstra/iot-connectivity-manager
v1.0.1
Published
Telstra IoT Connectivity Manager
Readme
Telstra IoT Connectivity Manager (ICM)
Telstra Internet of Things Connection Manager (ICM) allows you to view and manage your IoT connectivity services at scale and in detail.
https://dev.telstra.com/apis/iot-connectivity-service-api
Installing
npm i -s @telstra/icmGetting Started
Set the TELSTRA_CLIENT_ID and TELSTRA_CLIENT_SECRET environment variables.
You can find the Client id and Client secret here: https://accounts.dev.telstra.com/secrets/view-all-secrets.
Getting started using ESM (ES Modules)
:warning: To load an ES module, set "type": "module" in your package.json or use the .mjs extension.
/** Using ES Modules (ECMAScript) */
import { Services } from '@telstra/icm';
const services = new Services();
services
.getByImsi('123456789012345')
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});Authentication
Authentication through environment variables, a shared credentials file and json file import are supported.
Environment variables
Export the following two environment variables, replacing the values with your own credentials.
export TELSTRA_CLIENT_ID="<CLIENT_ID>"
export TELSTRA_CLIENT_SECRET="<CLIENT_SECRET>"Shared credentials
Create a ~/.telstra/credentials file in your home path with the following contents, replacing the values with your own credentials.
[default]
TELSTRA_CLIENT_ID = <CLIENT_ID>
TELSTRA_CLIENT_SECRET = <CLIENT_SECRET>JSON file import
Create a json file in your project path with the following contents, replacing the values with your own credentials.
{
"TELSTRA_CLIENT_ID": "<CLIENT_ID>",
"TELSTRA_CLIENT_SECRET": "<CLIENT_SECRET>"
}Then import the json file into your project source.
import { Services } from '@telstra/icm';
import AUTH_CONFIG from './credentials.json';
const services = new Services(AUTH_CONFIG);This should be done before any interactions requiring authentication.
Get a paginated, filtered list of IoT SIM services
import { Services } from '@telstra/icm';
const services = new Services();
services
.getAll()
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});Get a single IoT SIM service by IMSI
import { Services } from '@telstra/icm';
const services = new Services();
services
.getByImsi('123456789012345')
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});