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
}
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.

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": number,
  "length": number,
  "userMention": {
    object(UserMentionMetadata)
  }
}
Fields
type

enum(AnnotationType)

The type of this annotation.

startIndex

number

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

length

number

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

userMention

object(UserMentionMetadata)

The metadata of user mention.

AnnotationType

Type of the annotation.

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

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.

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.

Methods

create

Creates a message.

delete

Deletes a message.

get

Returns a message.

update

Updates a message.

Send feedback about...

Hangouts Chat API
Hangouts Chat API
Need help? Visit our support page.