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),
p: platform,
i: packageIdentifier,
ip: 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);
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
Contributors