Reference guide to the Sandbox Node.js SDK on how to authorize, instantiate and use its service classes to access the Open Gateway APIs.
More info: https://developers.opengateway.telefonica.com/
To install the SDK, run the following command:
npm install @telefonica/opengateway-sandbox-sdk
The SDK uses Client Credentials for authentication. You will need the clientId
and clientSecret
to initialize each service.
More info: https://developers.opengateway.telefonica.com/docs/usethesandbox
Example credentials:
const credentials = {
clientId: "your-client-id",
clientSecret: "your-client-secret",
};
Some methods require an authorization code (code
), while others may use CIBA (Client-Initiated Backchannel Authentication).
This method verifies if a given phone number is valid using an authentication code.
const client = new NumberVerification(credentials, code);
const result = await client.verify(phoneNumber);
console.log(result); // returns a boolean
-
Params:
-
phoneNumber
: The phone number to verify.
-
This method checks the device location either with an authentication code or using CIBA.
-
With Auth Code:
const client = new DeviceLocation(credentials, code); const result = await client.verify(latitude, longitude, radius, phoneNumber); console.log(result); // returns a boolean
-
With CIBA:
const client = new DeviceLocation(credentials, undefined, phoneNumber); const result = await client.verify(latitude, longitude, radius); console.log(result); // returns a boolean
-
Params:
-
latitude
: The latitude of the location. -
longitude
: The longitude of the location. -
radius
: The radius to check around the given location. -
phoneNumber
: (Optional) The phone number for CIBA.
-
Checks if a SIM swap has occurred for a given phone number.
-
With Auth Code:
const client = new Simswap(credentials.clientId, credentials.clientSecret, undefined, code); const result = await client.check(checkDays, phoneNumber); console.log(result); // returns a boolean
-
With CIBA:
const client = new Simswap(credentials.clientId, credentials.clientSecret, phoneNumber); const result = await client.check(checkDays); console.log(result); // returns a boolean
-
Params:
-
checkDays
: The number of days to check for a SIM swap. -
phoneNumber
: (Optional for CIBA) The phone number to check.
-
Retrieves the date of the last SIM swap.
-
With Auth Code:
const client = new Simswap(credentials.clientId, credentials.clientSecret, undefined, code); const result = await client.retrieveDate(phoneNumber); console.log(result); // returns a Date object
-
With CIBA:
const client = new Simswap(credentials.clientId, credentials.clientSecret, phoneNumber); const result = await client.retrieveDate(); console.log(result); // returns a Date object
-
Params:
-
phoneNumber
: (Optional for CIBA) The phone number to check.
-
Checks the roaming status of a device.
const client = new DeviceStatus(credentials, code);
const result = await client.roaming(externalId, msisdn, ipv4Addr, ipv6Addr, uePort);
console.log(result.roaming); // returns a boolean
-
Params:
-
externalId
: The external ID of the device. -
msisdn
: The mobile number. -
ipv4Addr
: The IPv4 address of the device. -
ipv6Addr
: The IPv6 address of the device. -
uePort
: The port number used by the device.
-
Creates and manages QoD (Quality of Data) mobile sessions.
const client = new QoDMobile(credentials, code);
const result = await client.sessions(
duration,
externalId,
msisdn,
ipv4Addr,
ipv6Addr,
uePorts,
undefined,
qos,
notificationUri,
notificationAuthToken
);
console.log(result);
-
Params:
-
duration
: Duration of the session in seconds. -
externalId
: The external ID of the user equipment (UE). -
msisdn
: The mobile number. -
ipv4Addr
: The IPv4 address of the user equipment. -
ipv6Addr
: The IPv6 address of the user equipment. -
uePorts
: The port range of the user equipment. -
qos
: Quality of service. -
notificationUri
: The URI for notifications. -
notificationAuthToken
: The token for notification authorization.
-