TextMessage

public final class TextMessage extends Object

Represents a text message from a certain user in a conversation, providing context for SmartReply to generate reply suggestions.

Public Method Summary

static TextMessage
createForLocalUser(String messageText, long timestampMillis)
Creates an instance of TextMessage for a local user.
static TextMessage
createForRemoteUser(String messageText, long timestampMillis, String remoteUserId)
Creates an instance of TextMessage for a remote user.

Inherited Method Summary

Public Methods

public static TextMessage createForLocalUser (String messageText, long timestampMillis)

Creates an instance of TextMessage for a local user. The local user is the current user of the app's instance and is the user for which SmartReply is generating a reply.

Parameters
messageText the message content.
timestampMillis timestamp of the message in milliseconds since midnight, January 1, 1970 UTC.

You can use, for example, java.lang.System.currentTimeMillis() to get the value.

public static TextMessage createForRemoteUser (String messageText, long timestampMillis, String remoteUserId)

Creates an instance of TextMessage for a remote user. Your local user may have a conversation with one or more remote users and providing context for messages your local user has received will help the API generate smart replies.

Parameters
messageText the message content.
timestampMillis timestamp of the message in milliseconds since midnight, January 1, 1970 UTC.

You can use, for example, java.lang.System.currentTimeMillis() to get the value.

remoteUserId a unique user ID representing a remote user if the local user is having a conversation with more than one remote user. It's only used to distinguish participants in the conversation.

SmartReplyGenerator is a stateless API, so there is no need to guarantee consistent user IDs across different API calls.