singular-s2s
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Singular-S2S

npm package to send events from server based on user interaction et. al.

Singular Docs

Installation

npm install singular-s2s

Usage example

import Singular from "singular-s2s";

const eventData: any = {
      n: "event_name",
      e: JSON.stringify(payload), //event data
      p: platform, // Android or iOS
      i: packageIdentifier, // your app package name like com.company.com
      ip: IP, // user iP
      utime: epochInSeconds(),
      umilisec: getEpoch(),
      custom_user_id: userEvent.user_uid,
    };
if (platform === Platform.ANDROID) {
    eventData.andi = headers["device-id"].toLowerCase();
}
if (platform === Platform.IOS) {
    eventData.idfv = headers["device-id"].toUpperCase();
}
const singular = new Singular(SINGULAR_CONFIG.API_KEY);
// code is executed with try catch block so check if error
const {error, response} = await singular.sendEvent(eventData); 

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Author

praveenkumarKajla
praveenkumarKajla

Contributors

Package Sidebar

Install

npm i singular-s2s

Weekly Downloads

2

Version

1.1.1

License

ISC

Unpacked Size

19.4 kB

Total Files

16

Last publish

Collaborators

  • kajlapk