REST Resource: spaces.messages

Resource: Message

A message in Hangouts Chat.

JSON representation
{
  "name": string,
  "sender": {
    object (User)
  },
  "createTime": string,
  "text": string,
  "cards": [
    {
      object (Card)
    }
  ],
  "previewText": string,
  "annotations": [
    {
      object (Annotation)
    }
  ],
  "thread": {
    object (Thread)
  },
  "space": {
    object (Space)
  },
  "fallbackText": string,
  "actionResponse": {
    object (ActionResponse)
  },
  "argumentText": string,
  "attachment": [
    {
      object (Attachment)
    }
  ],
  "slashCommand": {
    object (SlashCommand)
  }
}
Fields
name

string

Resource name, in the form "spaces/*/messages/*".

Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4

sender

object (User)

The user who created the message.

createTime

string (Timestamp format)

Output only. The time at which the message was created in Hangouts Chat server.

text

string

Plain-text body of the message.

cards[]

object (Card)

Rich, formatted and interactive cards that can be used to display UI elements such as: formatted texts, buttons, clickable images. Cards are normally displayed below the plain-text body of the message.

previewText

string

Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips.

annotations[]

object (Annotation)

Output only. Annotations associated with the text in this message.

thread

object (Thread)

The thread the message belongs to.

space

object (Space)

The space the message belongs to.

fallbackText

string

A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications).

actionResponse

object (ActionResponse)

Input only. Parameters that a bot can use to configure how its response is posted.

argumentText

string

Plain-text body of the message with all bot mentions stripped out.

attachment[]

object (Attachment)

User uploaded attachment.

slashCommand

object (SlashCommand)

Slash command information, if applicable.

Annotation

Annotations associated with the plain-text body of the message.

Example plain-text message body:

Hello @FooBot how are you!"

The corresponding annotations metadata:

"annotations":[{
  "type":"USER_MENTION",
  "startIndex":6,
  "length":7,
  "userMention": {
    "user": {
      "name":"users/107946847022116401880",
      "displayName":"FooBot",
      "avatarUrl":"https://goo.gl/aeDtrS",
      "type":"BOT"
    },
    "type":"MENTION"
   }
}]
JSON representation
{
  "type": enum (AnnotationType),
  "startIndex": integer,
  "length": integer,

  // Union field metadata can be only one of the following:
  "userMention": {
    object (UserMentionMetadata)
  },
  "slashCommand": {
    object (SlashCommandMetadata)
  }
  // End of list of possible types for union field metadata.
}
Fields
type

enum (AnnotationType)

The type of this annotation.

startIndex

integer

Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to.

length

integer

Length of the substring in the plain-text message body this annotation corresponds to.

Union field metadata. Additional metadata about the annotation. metadata can be only one of the following:
userMention

object (UserMentionMetadata)

The metadata of user mention.

slashCommand

object (SlashCommandMetadata)

The metadata for a slash command.

AnnotationType

Type of the annotation.

Enums
ANNOTATION_TYPE_UNSPECIFIED Default value for the enum. DO NOT USE.
USER_MENTION A user is mentioned.
SLASH_COMMAND A slash command is invoked.

UserMentionMetadata

Annotation metadata for user mentions (@).

JSON representation
{
  "user": {
    object (User)
  },
  "type": enum (Type)
}
Fields
user

object (User)

The user mentioned.

type

enum (Type)

The type of user mention.

Type

Enums
TYPE_UNSPECIFIED Default value for the enum. DO NOT USE.
ADD Add user to space.
MENTION Mention user in space.

SlashCommandMetadata

Annotation metadata for slash commands (/).

JSON representation
{
  "bot": {
    object (User)
  },
  "type": enum (Type),
  "commandName": string,
  "commandId": string,
  "triggersDialog": boolean
}
Fields
bot

object (User)

The bot whose command was invoked.

type

enum (Type)

The type of slash command.

commandName

string

The name of the invoked slash command.

commandId

string (int64 format)

The command id of the invoked slash command.

triggersDialog

boolean

Indicating whether the slash command is for a dialog.

Type

Enums
TYPE_UNSPECIFIED Default value for the enum. DO NOT USE.
ADD Add bot to space.
INVOKE Invoke slash command in space.

Thread

A thread in Hangouts Chat.

JSON representation
{
  "name": string
}
Fields
name

string

Resource name, in the form "spaces/*/threads/*".

Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4

ActionResponse

Parameters that a bot can use to configure how it's response is posted.

JSON representation
{
  "type": enum (ResponseType),
  "url": string
}
Fields
type

enum (ResponseType)

The type of bot response.

url

string

URL for users to auth or config. (Only for REQUEST_CONFIG response types.)

ResponseType

The type of bot response.

Enums
TYPE_UNSPECIFIED Default type; will be handled as NEW_MESSAGE.
NEW_MESSAGE Post as a new message in the topic.
UPDATE_MESSAGE Update the bot's own message. (Only after CARD_CLICKED events.)
REQUEST_CONFIG Privately ask the user for additional auth or config.

SlashCommand

A Slash Command in Hangouts Chat.

JSON representation
{
  "commandId": string
}
Fields
commandId

string (int64 format)

The id of the slash command invoked.

Methods

create

Creates a message.

delete

Deletes a message.

get

Returns a message.

update

Updates a message.