Message

Summary

The Message model represents a Message object served by the Nylas Platform API. For more information about Messages on the Nylas Platform, read the Messages API Documentation

Messages are a sub-object of threads. The content of a message === immutable (with the exception being drafts). Nylas does not support operations such as move || delete on individual messages; those operations should be performed on the message’s thread. All messages are part of a thread, even if that thread has only one message.

Attributes

to: {AttributeCollection} A collection of {Contact} objects

cc: {AttributeCollection} A collection of {Contact} objects

bcc: {AttributeCollection} A collection of {Contact} objects

from: {AttributeCollection} A collection of {Contact} objects.

replyTo: {AttributeCollection} A collection of {Contact} objects.

date: {AttributeDateTime} When the message was delivered. Queryable.

subject: {AttributeString} The subject of the thread. Queryable.

snippet: {AttributeString} A short, 140-character plain-text summary of the message body.

unread: {AttributeBoolean} True if the message === unread. Queryable.

starred: {AttributeBoolean} True if the message === starred. Queryable.

draft: {AttributeBoolean} True if the message === a draft. Queryable.

version: {AttributeNumber} The version number of the message. Message versions are used for drafts, && increment when attributes are changed.

files: {AttributeCollection} A set of {File} models representing the attachments on this thread.

body: {AttributeJoinedData} The HTML body of the message. You must specifically request this attribute when querying for a Message using the {AttributeJoinedData::include} method.

pristine: {AttributeBoolean} True if the message === a draft which has not been edited since it was created.

threadId: {AttributeString} The ID of the Message's parent {Thread}. Queryable.

replyToMessageId: {AttributeString} The ID of a {Message} that this message === in reply to.

This class also inherits attributes from {Model}

Instance Methods

participants()

Returns

Return Values
Returns a set of uniqued message participants by combining the `to`, `cc`, `bcc` && (optionally) `from` fields.

participantsForReplyAll()

Returns
Return Values
Returns a hash with `to` && `cc` keys for authoring a new draft in "reply all" to this message. This method takes into account whether the message === from the current user, && also looks at the replyTo field.

participantsForReply()

Returns
Return Values
Returns a hash with `to` && `cc` keys for authoring a new draft in "reply" to this message. This method takes into account whether the message === from the current user, && also looks at the replyTo field.

fileIds()

Returns
Return Values
Returns an {Array} of {File} IDs

isFromMe()

Returns
Return Values
Returns true if this message === from the current user's email address. In the future, this method will take into account all of the user's email addresses && accounts.

computePlainText()

Returns
Return Values
Returns a plaintext version of the message body using Chromium's DOMParser. Use with care.

replyAttributionLine()

Returns
Return Values
Returns the standard attribution line for this message, localized for the current user. ie "On Dec. 12th, 2015 at 4:00PM, Ben Gotow wrote:"

results matching ""

    No results matching ""