ICMessage
This class provides a concrete implementation of the ICMessageData interface to express In-App and Push channels in a generalized form and is used when receiving messages to or sending messages from the SDK. In addition to the class-specific methods listed below, reference the ICMessageData class for interface method details.
Return Type | Method |
---|---|
ICMessage | fromJSON(JSONObject jsonObj) |
ICMediaFile | getMedia() - Deprecated |
String | getTitle() |
void | setAttachments(ICAttachment[] attachments) |
void | setCustomTags(Bundle customTags) |
Bundle | getCustomTags() |
void | setDeliveredAt(Date date) |
void | setMedia(ICMediaFile[] media) - Deprecated |
void | setMessage(String message) |
void | setReadAt(Date date) |
void | setStatus(ICMessageStatus status) |
ICMessageStatus | getStatus() |
Date | getSubmittedAt() |
void | setThread(ICThread thread) |
ICThread | getThread() |
String | getTransactionId() |
JSONObject | toJSON() |
fromJSON
Returns an ICMessage instance from a JSONObject. The JSONObject must contain valid ICMessage data.
Syntax: static ICMessage fromJSON(JSONObject jsonObj)
Return Value: An ICMessage instance or null if the jsonObj parameter was null.
getMedia
Deprecated - Use getAttachments instead.
Returns any media files that are attached to the message.
Syntax: ICMediaFile[] getMedia()
Return Value: Returns the media files that were attached to the message or null if no media file attachments exist.
getTitle
Gets the message title, if present.
Syntax: String getTitle()
Return Value: Returns message title if present.
setAttachments
Used to set the attachments which will be sent with an outgoing message.
Syntax: setAttachments(final ICAttachment[] attachments)
Parameters:
Parameter | Type | Description |
---|---|---|
attachments | ICAttachment[] | The attachments to attach to the message. |
setCustomTags
This method is used to set the custom tags bundle to be sent with an outgoing Live Chat / In-App Messaging. This method is not applicable to Push messaging.
Syntax: void setCustomTags(Bundle tags)
Parameters:
Parameter | Type | Description |
---|---|---|
tags | Bundle | Specifies the Android bundle. |
getCustomTags
This method is used to return any custom tag data that was sent as part of the message.
Syntax: Bundle getCustomTags()
Returns: Returns the data that was sent as part of the message payload.
setDeliveredAt
Sets the date on which the message is considered delivered to the device.
The SDK sets the delivered status automatically when a message is received, there should be no need to call this method manually.
Syntax: void setDeliveredAt(Date date)
Parameters:
Parameter | Type | Description |
---|---|---|
date | Date | The date on which the message is considered as delivered. |
setMedia
Deprecated - Use setAttachments instead.
Attaches the specified media files to the message.
Syntax: void setMedia(ICMediaFile[] files)
Parameters:
Parameter | Type | Description |
---|---|---|
files | ICMediaFile | The media file array to attach to the message |
setMessage
Used to set the textual part of the message.
Syntax: void setMessage(String message)
Parameters:
Parameter | Type | Description |
---|---|---|
message | String | Specifies the text content of the message. |
setReadAt
Sets the date on which the message was considered as Read.
Syntax: void setReadAt(Date date)
Parameters:
Parameter | Type | Description |
---|---|---|
date | Date | The date on which the message was considered as read. |
setStatus
Sets the status of the message.
This method has limited use as message status is generally inferred based on delivered and read at dates. i.e. a message with a read at date is considered to be in the Read status.
Syntax: void setStatus(ICMessageStatus status)
Parameters:
Parameter | Type | Description |
---|---|---|
status | ICMessageStatus | The new message status |
getStatus
Returns the current status of the message (None/Sent/NotSent/Delivered/Read)
Syntax: ICMessageStatusgetStatus()
Return Value: Returns the current status of the message.
getSubmittedAt
Returns the date on which the message was submitted to the Webex Connect platform.
Syntax: Date getSubmittedAt()
Return Value: Message submission date.
setThread
Sets the thread instance to which the message belongs.
A valid thread instance must be assigned to a message before it can be published.
When replying to an existing thread, obtain the thread instance from an existing incoming message or from fetchMessages.
When publishing to a new thread, instantiate a new ICThread instance and use createThread to provision the thread within the Webex Connect platform before attempting to publish.
Syntax: void setThread(ICThread thread)
Parameters:
Parameter | Type | Description |
---|---|---|
thread | ICThread | The thread object to which the message should belong. |
getThread
Returns an ICThread instance representing the thread to which the message belongs.
Syntax: ICThread getThread()
Return Value: The ICThread to which the message belongs.
getTransactionId
Gets the transaction id that uniquely identifies the message within the Webex Connect platform.
Syntax: String getTransactionId()
Return Value: Returns the transaction id that identifies the message.
toJSON
Returns a JSON representation of the message.
Syntax: JSONObject toJSON()
Return Value: Message data as a JSONObject
getQuickReplyData
This method is used to return ICQuickReplyData instance that was sent as part of the message.
Syntax: ICQuickReplyData getQuickReplyData()
Return Value: ICQuickReplyData instance.
Updated 12 months ago