2015-10-03 01:57:40 +08:00
---
layout: docs
title: Message
2015-10-04 03:05:22 +08:00
edit_url: "https://github.com/nylas/N1/blob/master/src/flux/models/message.coffee"
2015-10-03 01:57:40 +08:00
---
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< h2 > Summary< / h2 >
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "markdown-from-sourecode" >
< p > < p > The Message model represents a Message object served by the Nylas Platform API.
2015-10-02 03:34:16 +08:00
For more information about Messages on the Nylas Platform, read the
< a href = "https://nylas.com/docs/api#messages" > Messages API Documentation< / a > < / p >
< p > Messages are a sub-object of threads. The content of a message is immutable (with the
exception being drafts). Nylas does not support operations such as move or 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.< / p >
< h2 id = "attributes" > Attributes< / h2 >
2015-10-03 01:57:40 +08:00
< p > < code > to< / code > : < a href = 'attributecollection.html' > AttributeCollection< / a > A collection of < a href = 'contact.html' > Contact< / a > objects< / p >
< p > < code > cc< / code > : < a href = 'attributecollection.html' > AttributeCollection< / a > A collection of < a href = 'contact.html' > Contact< / a > objects< / p >
< p > < code > bcc< / code > : < a href = 'attributecollection.html' > AttributeCollection< / a > A collection of < a href = 'contact.html' > Contact< / a > objects< / p >
< p > < code > from< / code > : < a href = 'attributecollection.html' > AttributeCollection< / a > A collection of < a href = 'contact.html' > Contact< / a > objects.< / p >
< p > < code > replyTo< / code > : < a href = 'attributecollection.html' > AttributeCollection< / a > A collection of < a href = 'contact.html' > Contact< / a > objects.< / p >
< p > < code > date< / code > : < a href = 'attributedatetime.html' > AttributeDateTime< / a > When the message was delivered. Queryable.< / p >
< p > < code > subject< / code > : < a href = 'attributestring.html' > AttributeString< / a > The subject of the thread. Queryable.< / p >
< p > < code > snippet< / code > : < a href = 'attributestring.html' > AttributeString< / a > A short, 140-character plain-text summary of the message body.< / p >
< p > < code > unread< / code > : < a href = 'attributeboolean.html' > AttributeBoolean< / a > True if the message is unread. Queryable.< / p >
< p > < code > starred< / code > : < a href = 'attributeboolean.html' > AttributeBoolean< / a > True if the message is starred. Queryable.< / p >
< p > < code > draft< / code > : < a href = 'attributeboolean.html' > AttributeBoolean< / a > True if the message is a draft. Queryable.< / p >
< p > < code > version< / code > : < a href = 'attributenumber.html' > AttributeNumber< / a > The version number of the message. Message
2015-10-02 03:34:16 +08:00
versions are used for drafts, and increment when attributes are changed.< / p >
2015-10-03 01:57:40 +08:00
< p > < code > files< / code > : < a href = 'attributecollection.html' > AttributeCollection< / a > A set of < a href = 'file.html' > File< / a > models representing
2015-10-02 03:34:16 +08:00
the attachments on this thread.< / p >
2015-10-03 01:57:40 +08:00
< p > < code > body< / code > : < a href = 'attributejoineddata.html' > AttributeJoinedData< / a > The HTML body of the message. You must specifically
request this attribute when querying for a Message using the {< a href = 'AttributeJoinedData.html#include' > AttributeJoinedData::include< / a > }
2015-10-02 03:34:16 +08:00
method.< / p >
2015-10-03 01:57:40 +08:00
< p > < code > pristine< / code > : < a href = 'attributeboolean.html' > AttributeBoolean< / a > True if the message is a draft which has not been
2015-10-02 03:34:16 +08:00
edited since it was created.< / p >
2015-10-03 01:57:40 +08:00
< p > < code > threadId< / code > : < a href = 'attributestring.html' > AttributeString< / a > The ID of the Message' s parent < a href = 'thread.html' > Thread< / a > . Queryable.< / p >
< p > < code > replyToMessageId< / code > : < a href = 'attributestring.html' > AttributeString< / a > The ID of a < a href = 'message.html' > Message< / a > that this message
2015-10-02 03:34:16 +08:00
is in reply to.< / p >
2015-10-03 01:57:40 +08:00
< p > This class also inherits attributes from < a href = 'model.html' > Model< / a > < / p >
2015-10-02 03:34:16 +08:00
< / p >
< / div >
2015-10-03 01:57:40 +08:00
< ul >
< / ul >
< h3 > Instance Methods< / h3 >
< h4 id = participants class = "function-name" >
participants(< span class = "args" > < / span > ) < a href = "#participants" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a set of uniqued message participants by combining the
< code > to< / code > , < code > cc< / code > , and < code > from< / code > fields.< / p >
< / td > < / tr >
< / table >
< h4 id = participantsForReplyAll class = "function-name" >
participantsForReplyAll(< span class = "args" > < / span > ) < a href = "#participantsForReplyAll" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a hash with < code > to< / code > and < code > cc< / code > keys for authoring a new draft in
" reply all" to this message. This method takes into account whether the
message is from the current user, and also looks at the replyTo field.< / p >
< / td > < / tr >
< / table >
< h4 id = participantsForReply class = "function-name" >
participantsForReply(< span class = "args" > < / span > ) < a href = "#participantsForReply" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a hash with < code > to< / code > and < code > cc< / code > keys for authoring a new draft in
" reply" to this message. This method takes into account whether the
message is from the current user, and also looks at the replyTo field.< / p >
< / td > < / tr >
< / table >
< h4 id = fileIds class = "function-name" >
fileIds(< span class = "args" > < / span > ) < a href = "#fileIds" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns an < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/array' > Array< / a > of < a href = 'file.html' > File< / a > IDs< / p >
< / td > < / tr >
< / table >
< h4 id = isFromMe class = "function-name" >
isFromMe(< span class = "args" > < / span > ) < a href = "#isFromMe" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns true if this message is from the current user' s email
address. In the future, this method will take into account all of the
user' s email addresses and accounts.< / p >
< / td > < / tr >
< / table >
< h4 id = plainTextBody class = "function-name" >
plainTextBody(< span class = "args" > < / span > ) < a href = "#plainTextBody" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a plaintext version of the message body using Chromium' s
DOMParser. Use with care.< / p >
< / td > < / tr >
< / table >
< h4 id = replyAttributionLine class = "function-name" >
replyAttributionLine(< span class = "args" > < / span > ) < a href = "#replyAttributionLine" class = "link" > < / a >
< / h4 >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < / p >
< / div >
2015-10-04 03:05:22 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns the standard attribution line for this message,
localized for the current user.
ie " On Dec. 12th, 2015 at 4:00PM, Ben Gotow wrote:" < / p >
< / td > < / tr >
< / table >