Representation of a Conversations Message object.
More...
Representation of a Conversations Message object.
| Attributes com.twilio.conversations.Message.getAttributes |
( |
| ) |
|
Retrieve attributes associated with this message.
- Returns
- the message Attributes.
| String com.twilio.conversations.Message.getAuthor |
( |
| ) |
|
The global identity of the author of this message.
- Returns
- The global identity.
| Conversation com.twilio.conversations.Message.getConversation |
( |
| ) |
|
Returns the parent conversation this message belongs to.
- Returns
- Conversation.
| String com.twilio.conversations.Message.getConversationSid |
( |
| ) |
|
Returns the conversation SID of the conversation this message belongs to.
- Returns
- Conversation SID.
| String com.twilio.conversations.Message.getDateCreated |
( |
| ) |
|
The creation date for this message.
- Returns
- The timestamp when this message was created.
| Date com.twilio.conversations.Message.getDateCreatedAsDate |
( |
| ) |
|
The creation timestamp for this message.
- Returns
- Date when this message was created or null if date string could not be parsed.
| String com.twilio.conversations.Message.getDateUpdated |
( |
| ) |
|
The timestamp when this message was updated last time.
- Returns
- Most recent timestamp when this message was updated.
| Date com.twilio.conversations.Message.getDateUpdatedAsDate |
( |
| ) |
|
The Date when this message was updated last time.
- Returns
- Most recent Date when this message was updated or null.
| String com.twilio.conversations.Message.getLastUpdatedBy |
( |
| ) |
|
- Returns
- The identity of the user who updated the message.
| void com.twilio.conversations.Message.getMediaContentTemporaryUrl |
( |
CallbackListener< String > |
listener | ) |
|
Request media download temporary link.
This URL is impermanent, it expires in several minutes. If the link became invalid (expired), need to re-request the new one. It is user's responsibility to timely download media data by this link.
- Parameters
-
| listener | Listener to receive temporary URL. |
- Exceptions
-
| IllegalStateException | When hasMedia returns false. |
| String com.twilio.conversations.Message.getMediaFileName |
( |
| ) |
|
Get file name of media stream.
- Returns
- file name of media stream.
- Exceptions
-
| IllegalStateException | When hasMedia returns false. |
| String com.twilio.conversations.Message.getMediaSid |
( |
| ) |
|
Get SID of media stream.
- Returns
- SID of media stream.
- Exceptions
-
| IllegalStateException | When hasMedia returns false. |
| long com.twilio.conversations.Message.getMediaSize |
( |
| ) |
|
Get size of media stream.
- Returns
- size of media stream.
- Exceptions
-
| IllegalStateException | When hasMedia returns false. |
| String com.twilio.conversations.Message.getMediaType |
( |
| ) |
|
Get mime-type of media stream.
- Returns
- mime-type string of media stream.
- Exceptions
-
| IllegalStateException | When hasMedia returns false. |
| String com.twilio.conversations.Message.getMessageBody |
( |
| ) |
|
The body for this message.
- Returns
- The message body.
| long com.twilio.conversations.Message.getMessageIndex |
( |
| ) |
|
Returns the index number for this message.
By design of the conversations system the message indices may have arbitrary gaps between them, that does not necessarily mean they were deleted or otherwise modified - just that messages may have non-contiguous indices even if they are sent immediately one after another.
Trying to use indices for some calculations is going to be unreliable.
To calculate the number of unread messages it is better to use the read horizon API. See Conversation#getUnreadMessagesCount for details.
- Returns
- the message index.
| Participant com.twilio.conversations.Message.getParticipant |
( |
| ) |
|
Returns the participant this message sent by.
- Returns
- Participant.
| String com.twilio.conversations.Message.getParticipantSid |
( |
| ) |
|
Returns the participant SID of the participant this message sent by.
- Returns
- Participant SID.
| String com.twilio.conversations.Message.getSid |
( |
| ) |
|
Returns the identifier for this message.
- Returns
- The message SID.
| Type com.twilio.conversations.Message.getType |
( |
| ) |
|
| boolean com.twilio.conversations.Message.hasMedia |
( |
| ) |
|
Helper method to check if message has media type.
- Returns
- true if message has type MEDIA, false otherwise.
Example
if (message.hasMedia()) {
String fileName = message.getMediaFileName();
}
| static Options com.twilio.conversations.Message.options |
( |
| ) |
|
|
static |
Options builder.
Use for constructing new message options in Conversation#sendMessage.
- Returns
- New empty Options object.
Example
Message.options()
.withMedia(new FileInputStream("/path/to/Somefile.txt"), "text/plain")
.withMediaFileName("file.txt");
Set attributes associated with this message.
Passing null will reset message attributes to an empty json object.
- Parameters
-
| attributes | The new developer-provided Attributes for this message. |
| listener | Listener that will receive callback with the result. |
| void com.twilio.conversations.Message.updateMessageBody |
( |
String |
body, |
|
|
StatusListener |
listener |
|
) |
| |
Updates the body for a message.
- Parameters
-
| body | The body for the message. |
| listener | Listener that will receive callback of the result. |