npm install --save morning-js
import { Morning } from 'morning.js';
const morning = new Morning(`<API KEY>`);
// 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: 'user@email.com',
personProperties: {
name: 'John Smith',
avatar: 'https://profile.com/image.png',
}
})
const metric = await morning.metrics.get(`METRIC ID`);
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@domain.com' });
const customer = await morning.people.search({ personId: '123456' });