morning-js
v1.0.0-beta7
Published
A typescript client for Morning Metrics.
Readme
Installation
npm install --save morning-jsUsage
Import Library
import { Morning } from 'morning.js';Initialize Client
const morning = new Morning(`<API KEY>`);Update Metrics
// Incrementing the base metric
await morning.metrics.increment(`METRIC ID`, 1)// Incrementing a metric with user data
await morning.metrics.increment(`METRIC ID`, 1, {
email: '[email protected]',
personProperties: {
name: 'John Smith',
avatar: 'https://profile.com/image.png',
}
})Reading Metrics
const metric = await morning.metrics.get(`METRIC ID`);Reading Customer Profiles
Reading by id:
const customer = await morning.people.get(`PERSON ID`);Searching by email or person id:
const customer = await morning.people.search({ email: '[email protected]' });const customer = await morning.people.search({ personId: '123456' });