A NodeJS and TypeScript wrapper for the macOS Reminders App.
- π₯ Easy to use interface to create, retrieve, update and delete lists and reminders
- πΎ CommonJS and ES6 modules
- π€ Typings available
- π© JXA-based communication with the Reminders App
npm i node-reminders
Use it in JavaScript with CommonJS or in TypeScript with ES6 modules.
// with JavaScript
const reminders = require('node-reminders');
// with TypeScript
import * as reminders from 'node-reminders';
async function run() {
// get lists
const lists = await reminders.getLists();
// create reminder
const laterToday = new Date();
laterToday.setHours(laterToday.getHours() + 8);
reminders.createReminder(lists[0].id, {
name: 'Call John',
body: 'Catch up on the plan',
remindMeDate: laterToday,
});
}
Resolves with the list of reminders lists.
Resolves with the detail of a specific list.
Creates a new reminders list and resolves with its ID.
Resolves with the reminders of a given list. Optionally specify which props to retrieve. The more props, the slower the query. See the reminders example for more.
Resolves with the information of a specific reminder. Optionally specify which props to retrieve.
Updates a reminder and resolves with its ID. Pass only the subset of parameters to modify.
Deletes a reminder and resolves with true
if successful. Throws exception otherwise.
Creates a reminder in a list and resolves with its ID. See example.
import { getLists } from 'node-reminders';
(async () => {
const lists = await getLists();
console.log(lists);
/**
* [
* { name: 'Reminders', id: '2480C298-017A-11EB-BBBF-CB4F4FDF3602' },
* { name: 'Family TODO', id: '3D8660F9-9925-461A-B5FB-B0DDD56B7925' }
* ]
*/
})();
import { getList } from 'node-reminders';
(async () => {
const list = await getList('2480C298-017A-11EB-BBBF-CB4F4FDF3602');
console.log(list);
/**
* { name: 'Reminders', id: '2480C298-017A-11EB-BBBF-CB4F4FDF3602' }
*/
})();
import { createList } from 'node-reminders';
(async () => {
const newList = await createList({ name: 'June Reminders' });
console.log(newList);
/**
* '8AE21B5E-466A-4FDA-B59B-10B8CC80418A'
*/
})();
Note: List deletion is not supported. It's simply not allowed either via .jxa
or .applescript
directly.
import { getReminders } from 'node-reminders';
(async () => {
const reminderList = await getReminders(
'2480C298-017A-11EB-BBBF-CB4F4FDF3602',
[ 'name', 'id', 'remindMeDate', 'completed', 'priority' ] // fetch only a subset of properties
);
console.log(reminderList);
/**
[
{ name: 'Call John',
id: 'x-apple-reminder://776E5676-BB79-4095-8317-C94863814B50',
remindMeDate: '2020-04-13T15:02:34.000Z',
completed: true,
priority: 0 },
{ name: 'Pay the bills',
id: 'x-apple-reminder://8D9A728B-24C3-420B-A664-352B3C06E689',
remindMeDate: '2025-04-15T15:09:08.000Z',
completed: false,
priority: 0 },
{ name: 'Ping Lina',
id: 'x-apple-reminder://6C6D0961-B80D-4967-A9D6-B73F8278A117',
remindMeDate: null,
completed: false,
priority: 0 },
]
*/
})();
import { getReminder } from 'node-reminders';
(async () => {
const reminder = await getReminder(
'x-apple-reminder://8D9A728B-24C3-420B-A664-352B3C06E689',
['name', 'remindMeDate', 'completed']
);
console.log(reminder);
/**
{
name: 'Pay the bills',
remindMeDate: '2025-04-15T15:09:08.000Z',
completed: false
}
*/
})();
import { updateReminder } from 'node-reminders';
(async () => {
const oneMonthLater = new Date();
oneMonthLater.setFullYear(oneMonthLater.getMonth() + 1);
const edited = await reminders.updateReminder(
'x-apple-reminder://8D9A728B-24C3-420B-A664-352B3C06E689',
{
name: 'Pay cable',
completed: true,
remindMeDate: oneMonthLater,
}
);
console.log(edited);
/**
* 'x-apple-reminder://8D9A728B-24C3-420B-A664-352B3C06E689'
*/
})();
import { deleteReminder } from 'node-reminders';
(async () => {
try {
const deletedReminder = await reminders.deleteReminder('2480C298-017A-11EB-BBBF-CB4F4FDF3602');
console.log(deleteReminder);
} catch(e) {
console.error('Something failed. Could not delete the reminder.');
}
/**
* true
*/
})();
import { createReminder } from 'node-reminders';
(async () => {
const laterToday = new Date();
laterToday.setHours(laterToday.getHours() + 8);
const newReminder = await createReminder(
'2480C298-017A-11EB-BBBF-CB4F4FDF3602',
{
name: 'Update daily journal',
body: 'Lots of things going on',
remindMeDate: laterToday,
completed: false,
});
console.log(newReminder);
/**
* 'x-apple-reminder://32E91818-16FB-4E89-9C36-4960207AEA12
*/
})();
The interface prop names are self-explanatory. Descriptions are intentionally omitted.
Param | Type |
---|---|
name | string |
id | string |
Param | Type |
---|---|
name | string |
body | string |
id | string |
complete | boolean |
completionDate | Date |
creationDate | Date |
dueDate | Date |
modificationDate | Date |
remindMeDate | Date |
priority | number |
Under the hood, this library is an interface to run JXA scripts in the terminal. JXA is JavaScript for OSX automation. You can find all the scripts in src/jxa
. Arguments and outputs are passed back and forth via stringified objects.
MIT Β© Carlos Roso