Node.js Client
A TypeScript-first package that wraps the WaterlyConnect REST API with generated schema types and a small axios-based HTTP client. Best for server-side services, adapter layers, ETL jobs, and any Node.js runtime that needs a typed path from tag data to a successful submission.
TSGenerated schema types
axiosHTTP transport
CJSCommonJS build included
Prerequisites
- Node.js available in the environment that will submit payloads.
-
A Waterly-provided submission URL ending in
/api/data-submission/v1/submit. -
A client token and an assigned device identity (
idandtype) from the Waterly team. - Outbound HTTPS access from your runtime to the WaterlyConnect endpoint.
Quick Start
-
1
Install the package. Add
@waterclick/waterlyconnect-nodejs-clientto your project dependencies. -
2
Create the config. Supply the submission URL, your client token, and the device object with
idandtype. -
3
Instantiate and submit. Create a
WaterlyConnectApiClientand callsubmitDatawith an array ofTagDatumobjects.
Submission Example
import {
TagDatum,
WaterlyConnectApiClient,
WaterlyConnectApiClientConfig
} from "@waterclick/waterlyconnect-nodejs-client";
const config: WaterlyConnectApiClientConfig = {
url: "https://connect.waterly.com/api/data-submission/v1/submit",
clientToken: "your-client-token",
clientDevice: {
id: "plant-west-01",
type: "SCADA Gateway"
}
};
const client = new WaterlyConnectApiClient(config);
const tags: TagDatum[] = [
{
name: "FinishedWaterFlow",
value: "123.2",
last_change_timestamp: Math.floor(Date.now() / 1000)
},
{
name: "ClearwellLevel",
value: "14.7",
last_change_timestamp: Math.floor(Date.now() / 1000),
unit: "FT"
}
];
await client.submitData(tags);
Files