Guide for storing Email Conversations in FileNotes
Use FileNotes to store the email conversation itself, then use Alto Documents to store any related attachments against the same record.
Create the FileNote
Section titled āCreate the FileNoteāTo create an email conversation record, first call POST /file-notes and set fileNoteType to EMail.
{ "fileNoteType": "EMail"}Store the returned FileNoteId because you will need it when uploading attachments and when reading the conversation back later.
Upload email attachments
Section titled āUpload email attachmentsāAfter creating the FileNote, upload each attachment using Alto.Documents.Api POST /documents/post.
Set:
LinkedTypetoFileNoteorHistoryEventLinkedIdto the newFileNoteId
{ "LinkedType": "FileNote", "LinkedId": "<new_FileNoteId>"}This keeps the attachment linked to the email conversation record.
Read email conversations
Section titled āRead email conversationsāTo read email conversations, first retrieve the FileNote data by calling either:
GET /inventory/{propertyId}/file-notesGET /file-notes/{fileNoteId}
When reading FileNotes, make sure fileNoteType is set to EMail so that you only retrieve email conversation records.
Read linked attachments
Section titled āRead linked attachmentsāAfter retrieving the FileNote, make a second call to GET /documents to retrieve any linked attachments.
Set:
LinkedTypetoFileNoteorHistoryEventLinkedIdto thefile_note_id
{ "LinkedType": "FileNote", "LinkedId": "<file_note_id>"}