Skip to content

Users Chat

Ross Scroggs edited this page Jun 2, 2023 · 50 revisions

Users - Chat

API documentation

Introduction

These features were added in version 6.60.00.

To use these commands you must update your service account authorization.

gam user user@domain.com update serviceaccount

[*]  3)  Chat API - Memberships (supports readonly)
[*]  4)  Chat API - Messages (supports readonly)
[*]  5)  Chat API - Spaces (supports readonly)
[*]  6)  Chat API - Spaces Delete

Definitions

<StorageBucketName> ::= <String>
<StorageObjectName> ::= <String>
<StorageBucketObjectName> ::=
        https://storage.cloud.google.com/<StorageBucketName>/<StorageObjectName>|
        https://storage.googleapis.com/<StorageBucketName>/<StorageObjectName>|
        gs://<StorageBucketName>/<StorageObjectName>|
        <StorageBucketName>/<StorageObjectName>

<UserGoogleDoc> ::=
        <EmailAddress> <DriveFileIDEntity>|<DriveFileNameEntity>|(<SharedDriveEntity> <SharedDriveFileNameEntity>)

<ChatContent> ::=
        ((text <String>)|
         (textfile <FileName> [charset <CharSet>])|
         (gdoc <UserGoogleDoc>)|
         (gcsdoc <StorageBucketObjectName>))

<ChatMember> ::= spaces/<String>/members/<String>
<ChatMessage> ::= spaces/<String>/messages/<String>
<ChatSpace> ::= spaces/<String> | <String>
<ChatThread> ::= spaces/<String>/threads/<String>
<ChatSpaceType> ::=
        space|
	groupchat|
	directmessage
<ChatSpaceTypeList> ::= "<ChatSpaceType>(,<ChatSpaceType>)*"

Manage Chat Spaces

Create a chat space

gam <UserTypeEntity> create chatspace
        [displayname <String>]
        [type <ChatSpaceType>]
        [description <String>] [guidelines <String>]
        [history <Boolean>]
        [formatjson]

By default, Gam displays the information about the created chatspace as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.

Update a chat space

gam <UserTypeEntity> update chatspace space <ChatSpace>
        [displayname <String>]
        [type space]
        [description <String>] [guidelines <String>]
        [history <Boolean>]
        [formatjson]

By default, Gam displays the information about the created chatspace as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.

Delete a chat space

gam <UserTypeEntity> delete chatspace space <ChatSpace>

Display Chat Spaces

Display information about a specific chat space

gam <UserTypeEntity> info chatspace space <ChatSpace>
        [formatjson]

By default, Gam displays the information as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.

Display information about all chat spaces

gam <UserTypeEntity> show chatspaces
        [types <ChatSpaceTypeList>]
        [formatjson]

By default, Gam displays the information as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.
gam <UserTypeEntity> print chatspaces [todrive <ToDriveAttribute>*]
        [types <ChatSpaceTypeList>]
        [formatjson [quotechar <Character>]]

By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,

  • formatjson - Display the fields in JSON format.

By default, when writing CSV files, Gam uses a quote character of double quote ". The quote character is used to enclose columns that contain the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled. When using the formatjson option, double quotes are used extensively in the data resulting in hard to read/process output. The quotechar <Character> option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output. quotechar defaults to gam.cfg/csv_output_quote_char. When uploading CSV files to Google, double quote " should be used.

Manage Chat Members

Add a member to a chat space

gam <UserTypeEntity> create chatmember space <ChatSpace> member <UserItem>
        [type human|bot]
        [formatjson]

By default, Gam displays the information about the member as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.

Delete a member from a chat space

gam <UserTypeEntity> delete chatmember member <ChatMember>

Display Chat Members

Display information about a specific chat member

gam <UserTypeEntity> info chatmember member <ChatMember>
        [formatjson]

By default, Gam displays the information as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.

Display information about all chat members in a chat space

gam <UserTypeEntity> show chatmembers space <ChatSpace>
        [formatjson]

By default, Gam displays the information as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.
gam <UserTypeEntity> print chatmembers [todrive <ToDriveAttribute>*] space <ChatSpace>
        [formatjson [quotechar <Character>]]

By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,

  • formatjson - Display the fields in JSON format.

By default, when writing CSV files, Gam uses a quote character of double quote ". The quote character is used to enclose columns that contain the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled. When using the formatjson option, double quotes are used extensively in the data resulting in hard to read/process output. The quotechar <Character> option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output. quotechar defaults to gam.cfg/csv_output_quote_char. When uploading CSV files to Google, double quote " should be used.

Manage Chat Messages

Create a chat message in a space

Messages are limited to 4,096 characters and will be trimmed to that length.

Chat supports simple formatting allowing you to bold, underline, italics and strikethrough your text.

gam <UserTypeEntity> create chatmessage space <ChatSpace> [thread <ChatThread>]
        <ChatContent>

By default, a new message thread is created; use thread <ChatThread> to append the message to an existing thread.

Specify the source of the message:

  • text <String> - The message is <String>
  • textfile <FileName> [charset <CharSet>] - The message is read from a local file
  • gdoc <UserGoogleDoc> - The message is read from a Google Doc.
  • gcsdoc <StorageBucketObjectName> - The message is read from a Google Cloud Storage file.

Examples

This example creates a new chat message in the given room.

gam user user@domain.com create chatmessage space spaces/iEMj8AAAAAE text "Hello Chat"

This example creates a formatted message and posts it to an existing thread

gam user user@domain.comcreate chatmessage space spaces/AAAADi-pvqc thread spaces/AAAADi-pvqc/threads/FMNw-iE9jN4 text "*Bold* _Italics_ ~Strikethrough~"

This example reads the MotD.txt file and posts its contents to Chat.

gam user user@domain.comcreate chatmessage spaces spaces/AAAADi-pvqc textfile MotD.txt

This example reads the Google Doc MotD and posts its contents to Chat.

gam user user@domain.comcreate chatmessage spaces spaces/AAAADi-pvqc gdoc announcements@domain.com name "MotD"

Update a Chat Message

Updates and rewrites an existing Chat message. Message will show as edited and no notification will be sent to members.

gam <UserTypeEntity> update chatmessage name <ChatMessage>
        <ChatContent>

Specify the source of the message:

  • text <String> - The message is <String>
  • textfile <FileName> [charset <CharSet>] - The message is read from a local file
  • gdoc <UserGoogleDoc> - The message is read from a Google Doc.
  • gcsdoc <StorageBucketObjectName> - The message is read from a Google Cloud Storage file.

Example

This example updates an existing chat message with new text.

gam user user@domain.comupdate chatmessage name spaces/AAAADi-pvqc/messages/PKJrx90ooIU.PKJrx90ooIU text "HELLO CHAT?"

Delete a Chat Message

Deletes the given Chat message. Members will no longer see the message.

gam <UserTypeEntity> delete chatmessage name <ChatMessage>

Example

gam user user@domain.comdelete chatmessage name spaces/AAAADi-pvqc/messages/PKJrx90ooIU.PKJrx90ooIU

Display Chat Messages

Display a specific Chat message.

gam <UserTypeEntity> info chatmessage name <ChatMessage>
        [formatjson]

By default, Gam displays the information as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.

Example

gam user user@domain.com info chatmessage name spaces/AAAADi-pvqc/messages/PKJrx90ooIU.PKJrx90ooIU

Display information about all chat messages in a chat space

gam <UserTypeEntity> show chatmessages space <ChatSpace>
        [formatjson]

By default, Gam displays the information as an indented list of keys and values.

  • formatjson - Display the fields in JSON format.
gam <UserTypeEntity> print chatmessages [todrive <ToDriveAttribute>*] space <ChatSpace>
        [formatjson [quotechar <Character>]]

By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,

  • formatjson - Display the fields in JSON format.

By default, when writing CSV files, Gam uses a quote character of double quote ". The quote character is used to enclose columns that contain the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled. When using the formatjson option, double quotes are used extensively in the data resulting in hard to read/process output. The quotechar <Character> option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output. quotechar defaults to gam.cfg/csv_output_quote_char. When uploading CSV files to Google, double quote " should be used.

Update History

Installation

Configuration

Notes and Information

Definitions

Command Processing

Collections

Client Access

Special Service Account Access

Service Account Access

Clone this wiki locally