@telefonica/opengateway-sandbox-sdk

0.2.0-beta • Public • Published

Telefonica Opengateway Sandbox Node.js SDK

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/

Table of Contents


Installation

To install the SDK, run the following command:

npm install @telefonica/opengateway-sandbox-sdk

Authentication

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).

Methods | Service APIs

Number Verification

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.

Device Location

This method checks the device location either with an authentication code or using CIBA.

  1. With Auth Code:

    const client = new DeviceLocation(credentials, code);
    const result = await client.verify(latitude, longitude, radius, phoneNumber);
    console.log(result); // returns a boolean
  2. 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.

SIM Swap Check

Checks if a SIM swap has occurred for a given phone number.

  1. 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
  2. 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.

SIM Swap Date Retrieval

Retrieves the date of the last SIM swap.

  1. 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
  2. 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.

Device Status

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.

QoD Mobile Sessions

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @telefonica/opengateway-sandbox-sdk

Weekly Downloads

1

Version

0.2.0-beta

License

ISC

Unpacked Size

282 kB

Total Files

4

Last publish

Collaborators

  • tdaf
  • aura
  • living-apps
  • lifecyle-novum