Phygrid Developers
Browse Topics
Node JS App Integration / Phygrid Developers

Node JS App Integration

This page describes how you can integrate your NodeJS or Non-react JavaScript-based gridapps.

Functions

States and Events

init

Used to initialize the Grid Signals instance with the required Init Parameters.

import GridSignals from '@ombori/grid-signals';

...
const gs = new GridSignals();
await gs.init(params)
...

Usage

import GridSignals from '@ombori/grid-signals';

...

const gs = new GridSignals();
await gs.init({
  deviceId: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  installationId: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  spaceId: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  tenantId: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  appVersion: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  appId: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  environment: 'PROD',
  dataResidency: 'EU',
  country: 'SE',
  installationVersion: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  accessId: 'XXXX',
  accessToken: 'XXXX',
});

await gs.sendCustomEvent({
  eventType: 'RECYCLE',
  interaction: true,
  str1: 'bottles', // unit
  int1: 5, // quantity
});

...

Grid Signals Init Parameters

KeyTypeDescriptionRequiredOptions
tenantIdstringTenant id in the Grid Consoleyes
environmentstringApplication environmentyes
dataResidencystringThe region where to store the datayes"EU", "UAE", "IN", "US", "AU"
countrystringTenant base country (Abbrev.)yes
spaceIdstringThe id of the Space where the device or any entity is locatedyes
appIdstringThe id of the gridapp which is running on a deviceyes
appVersionstring

List of Product Type IDs applicable to this product as a reference from ProductTypes Database

yes
installationIdstringThe id of the installation in Grid Consoleyes
installationVersionstringBuild id of the installationyes
deviceIdstring

Id of the device in the console. If deviceId is not passed, virtual deviceId is created

no
clientUserAgentstringRequestor user agentyes
locationAccuracynumberGeographic coordinates accuracyno
latitudenumberGeographic latitude of the device or requestorno-90 to 90
longitudenumberGeographic longitude of the device or requestorno-180 to 180
accessIdstring

Credentials used when subscribing to session or space state or events

no
accessTokenstring

Credentials used when subscribing to session or space state or events

no

Event Tracking

See Event Tracking page for more details.

© 2024 · Phygrid. An Ombori company