Skip to content

Build your personal knowledge base with Trilium Notes

add sender API to send text notes

azivner4b1d1aba748e
diff --git a/src/routes/api/sender.js b/src/routes/api/sender.js
index 5fd76f3a49..a85d3e1880 100644
--- a/src/routes/api/sender.js
+++ b/src/routes/api/sender.js
@@ -88,4 +88,19 @@ router.post('/image', checkSenderToken, multer.single('upload'), wrap(async (req
res.send({});
}));
+router.post('/note', checkSenderToken, wrap(async (req, res, next) => {
+ const parentNoteId = await date_notes.getDateNoteId(req.headers['x-local-date']);
+
+ await notes.createNewNote(parentNoteId, {
+ title: req.body.title,
+ content: req.body.content,
+ target: 'into',
+ isProtected: false,
+ type: 'text',
+ mime: 'text/html'
+ });
+
+ res.send({});
+}));
+
module.exports = router;
\ No newline at end of file