1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
|
<html><body>
<style>
body, h1, h2, h3, div, span, p, pre, a {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
font-size: 13px;
padding: 1em;
}
h1 {
font-size: 26px;
margin-bottom: 1em;
}
h2 {
font-size: 24px;
margin-bottom: 1em;
}
h3 {
font-size: 20px;
margin-bottom: 1em;
margin-top: 1em;
}
pre, code {
line-height: 1.5;
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}
pre {
margin-top: 0.5em;
}
h1, h2, h3, p {
font-family: Arial, sans serif;
}
h1, h2, h3 {
border-bottom: solid #CCC 1px;
}
.toc_element {
margin-top: 0.5em;
}
.firstline {
margin-left: 2 em;
}
.method {
margin-top: 1em;
border: solid 1px #CCC;
padding: 1em;
background: #EEE;
}
.details {
font-weight: bold;
font-size: 14px;
}
</style>
<h1><a href="chat_v1.html">Google Chat API</a> . <a href="chat_v1.spaces.html">spaces</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
<code><a href="chat_v1.spaces.members.html">members()</a></code>
</p>
<p class="firstline">Returns the members Resource.</p>
<p class="toc_element">
<code><a href="chat_v1.spaces.messages.html">messages()</a></code>
</p>
<p class="firstline">Returns the messages Resource.</p>
<p class="toc_element">
<code><a href="chat_v1.spaces.spaceEvents.html">spaceEvents()</a></code>
</p>
<p class="firstline">Returns the spaceEvents Resource.</p>
<p class="toc_element">
<code><a href="#close">close()</a></code></p>
<p class="firstline">Close httplib2 connections.</p>
<p class="toc_element">
<code><a href="#completeImport">completeImport(name, body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) and domain-wide delegation with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.import` For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).</p>
<p class="toc_element">
<code><a href="#create">create(body=None, requestId=None, x__xgafv=None)</a></code></p>
<p class="firstline">Creates a space. Can be used to create a named space, or a group chat in `Import mode`. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces.create` - `https://www.googleapis.com/auth/chat.app.spaces` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.create` - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) When authenticating as an app, the `space.customer` field must be set in the request. When authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set `space.permission_settings.manage_apps` to `managers_allowed`. Space membership upon creation depends on whether the space is created in `Import mode`: * **Import mode:** No members are created. * **All other modes:** The calling user is added as a member. This is: * The app itself when using app authentication. * The human user when using user authentication. If you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name.</p>
<p class="toc_element">
<code><a href="#delete">delete(name, useAdminAccess=None, x__xgafv=None)</a></code></p>
<p class="firstline">Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope: - `https://www.googleapis.com/auth/chat.app.delete` (only in spaces the app created) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.delete` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scope is used: - `https://www.googleapis.com/auth/chat.admin.delete`</p>
<p class="toc_element">
<code><a href="#findDirectMessage">findDirectMessage(name=None, x__xgafv=None)</a></code></p>
<p class="firstline">Returns the existing direct message with the specified user. If no direct message space is found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app. With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: - `https://www.googleapis.com/auth/chat.bot` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces`</p>
<p class="toc_element">
<code><a href="#get">get(name, useAdminAccess=None, x__xgafv=None)</a></code></p>
<p class="firstline">Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.bot` - `https://www.googleapis.com/auth/chat.app.spaces` with [administrator approval](https://support.google.com/a?p=chat-app-auth) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and one of the following authorization scopes is used: - `https://www.googleapis.com/auth/chat.admin.spaces.readonly` - `https://www.googleapis.com/auth/chat.admin.spaces` App authentication has the following limitations: - `space.access_settings` is only populated when using the `chat.app.spaces` scope. - `space.predefind_permission_settings` and `space.permission_settings` are only populated when using the `chat.app.spaces` scope, and only for spaces the app created.</p>
<p class="toc_element">
<code><a href="#list">list(filter=None, pageSize=None, pageToken=None, x__xgafv=None)</a></code></p>
<p class="firstline">Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: - `https://www.googleapis.com/auth/chat.bot` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` To list all named spaces by Google Workspace organization, use the [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.</p>
<p class="toc_element">
<code><a href="#list_next">list_next()</a></code></p>
<p class="firstline">Retrieves the next page of results.</p>
<p class="toc_element">
<code><a href="#patch">patch(name, body=None, updateMask=None, useAdminAccess=None, x__xgafv=None)</a></code></p>
<p class="firstline">Updates a space. For an example, see [Update a space](https://developers.google.com/workspace/chat/update-spaces). If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, try a different display name.. An existing space within the Google Workspace organization might already use this display name. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scopes is used: - `https://www.googleapis.com/auth/chat.admin.spaces` App authentication has the following limitations: - To update either `space.predefined_permission_settings` or `space.permission_settings`, the app must be the space creator. - Updating the `space.access_settings.audience` is not supported for app authentication.</p>
<p class="toc_element">
<code><a href="#search">search(orderBy=None, pageSize=None, pageToken=None, query=None, useAdminAccess=None, x__xgafv=None)</a></code></p>
<p class="firstline">Returns a list of spaces in a Google Workspace organization based on an administrator's search. In the request, set `use_admin_access` to `true`. For an example, see [Search for and manage spaces](https://developers.google.com/workspace/chat/search-manage-admin). Requires [user authentication with administrator privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges) and one of the following [authorization scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.admin.spaces.readonly` - `https://www.googleapis.com/auth/chat.admin.spaces`</p>
<p class="toc_element">
<code><a href="#search_next">search_next()</a></code></p>
<p class="firstline">Retrieves the next page of results.</p>
<p class="toc_element">
<code><a href="#setup">setup(body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see [Set up a space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). To specify the human members to add, add memberships with the appropriate `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user@example.com` or `users/123456789`. To specify the Google groups to add, add memberships with the appropriate `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud Identity Groups lookup API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID `123456789` for group email `group@example.com`, then you can add the group to the space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not supported, and Google groups can only be added as members in named spaces. For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn't have permission to add some members, then those members aren't added to the created space. To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created. To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to `true` and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](https://developers.google.com/workspace/chat/create-members). If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned. Spaces with threaded replies aren't supported. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following [authorization scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.spaces.create` - `https://www.googleapis.com/auth/chat.spaces`</p>
<h3>Method Details</h3>
<div class="method">
<code class="details" id="close">close()</code>
<pre>Close httplib2 connections.</pre>
</div>
<div class="method">
<code class="details" id="completeImport">completeImport(name, body=None, x__xgafv=None)</code>
<pre>Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) and domain-wide delegation with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.import` For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).
Args:
name: string, Required. Resource name of the import mode space. Format: `spaces/{space}` (required)
body: object, The request body.
The object takes the form of:
{ # Request message for completing the import process for a space.
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response message for completing the import process for a space.
"space": { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app. # The import mode space.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
},
}</pre>
</div>
<div class="method">
<code class="details" id="create">create(body=None, requestId=None, x__xgafv=None)</code>
<pre>Creates a space. Can be used to create a named space, or a group chat in `Import mode`. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces.create` - `https://www.googleapis.com/auth/chat.app.spaces` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.create` - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) When authenticating as an app, the `space.customer` field must be set in the request. When authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set `space.permission_settings.manage_apps` to `managers_allowed`. Space membership upon creation depends on whether the space is created in `Import mode`: * **Import mode:** No members are created. * **All other modes:** The calling user is added as a member. This is: * The app itself when using app authentication. * The human user when using user authentication. If you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name.
Args:
body: object, The request body.
The object takes the form of:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}
requestId: string, Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}</pre>
</div>
<div class="method">
<code class="details" id="delete">delete(name, useAdminAccess=None, x__xgafv=None)</code>
<pre>Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope: - `https://www.googleapis.com/auth/chat.app.delete` (only in spaces the app created) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.delete` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scope is used: - `https://www.googleapis.com/auth/chat.admin.delete`
Args:
name: string, Required. Resource name of the space to delete. Format: `spaces/{space}` (required)
useAdminAccess: boolean, Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.delete` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
}</pre>
</div>
<div class="method">
<code class="details" id="findDirectMessage">findDirectMessage(name=None, x__xgafv=None)</code>
<pre>Returns the existing direct message with the specified user. If no direct message space is found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app. With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: - `https://www.googleapis.com/auth/chat.bot` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces`
Args:
name: string, Required. Resource name of the user to find direct message with. Format: `users/{user}`, where `{user}` is either the `id` for the [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or the `id` for the [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Directory API. For example, if the People API profile ID is `123456789`, you can find a direct message with that person by using `users/123456789` as the `name`. When [authenticated as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), you can use the email as an alias for `{user}`. For example, `users/example@gmail.com` where `example@gmail.com` is the email of the Google Chat user.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}</pre>
</div>
<div class="method">
<code class="details" id="get">get(name, useAdminAccess=None, x__xgafv=None)</code>
<pre>Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.bot` - `https://www.googleapis.com/auth/chat.app.spaces` with [administrator approval](https://support.google.com/a?p=chat-app-auth) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and one of the following authorization scopes is used: - `https://www.googleapis.com/auth/chat.admin.spaces.readonly` - `https://www.googleapis.com/auth/chat.admin.spaces` App authentication has the following limitations: - `space.access_settings` is only populated when using the `chat.app.spaces` scope. - `space.predefind_permission_settings` and `space.permission_settings` are only populated when using the `chat.app.spaces` scope, and only for spaces the app created.
Args:
name: string, Required. Resource name of the space, in the form `spaces/{space}`. Format: `spaces/{space}` (required)
useAdminAccess: boolean, Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.spaces` or `chat.admin.spaces.readonly` [OAuth 2.0 scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}</pre>
</div>
<div class="method">
<code class="details" id="list">list(filter=None, pageSize=None, pageToken=None, x__xgafv=None)</code>
<pre>Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: - `https://www.googleapis.com/auth/chat.bot` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` To list all named spaces by Google Workspace organization, use the [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.
Args:
filter: string, Optional. A query filter. You can filter spaces by the space type ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). To filter by space type, you must specify valid enum value, such as `SPACE` or `GROUP_CHAT` (the `space_type` can't be `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` operator. For example, the following queries are valid: ``` space_type = "SPACE" spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error.
pageSize: integer, Optional. The maximum number of spaces to return. The service might return fewer than this value. If unspecified, at most 100 spaces are returned. The maximum value is 1000. If you use a value more than 1000, it's automatically changed to 1000. Negative values return an `INVALID_ARGUMENT` error.
pageToken: string, Optional. A page token, received from a previous list spaces call. Provide this parameter to retrieve the subsequent page. When paginating, the filter value should match the call that provided the page token. Passing a different value may lead to unexpected results.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # The response for a list spaces request.
"nextPageToken": "A String", # You can send a token as `pageToken` to retrieve the next page of results. If empty, there are no subsequent pages.
"spaces": [ # List of spaces in the requested (or first) page. Note: The `permissionSettings` field is not returned in the Space object for list requests.
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
},
],
}</pre>
</div>
<div class="method">
<code class="details" id="list_next">list_next()</code>
<pre>Retrieves the next page of results.
Args:
previous_request: The request for the previous page. (required)
previous_response: The response from the request for the previous page. (required)
Returns:
A request object that you can call 'execute()' on to request the next
page. Returns None if there are no more items in the collection.
</pre>
</div>
<div class="method">
<code class="details" id="patch">patch(name, body=None, updateMask=None, useAdminAccess=None, x__xgafv=None)</code>
<pre>Updates a space. For an example, see [Update a space](https://developers.google.com/workspace/chat/update-spaces). If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, try a different display name.. An existing space within the Google Workspace organization might already use this display name. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scopes is used: - `https://www.googleapis.com/auth/chat.admin.spaces` App authentication has the following limitations: - To update either `space.predefined_permission_settings` or `space.permission_settings`, the app must be the space creator. - Updating the `space.access_settings.audience` is not supported for app authentication.
Args:
name: string, Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`. (required)
body: object, The request body.
The object takes the form of:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}
updateMask: string, Required. The updated field paths, comma separated if there are multiple. You can update the following fields for a space: `space_details`: Updates the space's description. Supports up to 150 characters. `display_name`: Only supports updating the display name for spaces where `spaceType` field is `SPACE`. If you receive the error message `ALREADY_EXISTS`, try a different value. An existing space within the Google Workspace organization might already use this display name. `space_type`: Only supports changing a `GROUP_CHAT` space type to `SPACE`. Include `display_name` together with `space_type` in the update mask and ensure that the specified space has a non-empty display name and the `SPACE` space type. Including the `space_type` mask and the `SPACE` type in the specified space when updating the display name is optional if the existing space already has the `SPACE` type. Trying to update the space type in other ways results in an invalid argument error. `space_type` is not supported with `useAdminAccess`. `space_history_state`: Updates [space history settings](https://support.google.com/chat/answer/7664687) by turning history on or off for the space. Only supported if history settings are enabled for the Google Workspace organization. To update the space history state, you must omit all other field masks in your request. `space_history_state` is not supported with `useAdminAccess`. `access_settings.audience`: Updates the [access setting](https://support.google.com/chat/answer/11971020) of who can discover the space, join the space, and preview the messages in named space where `spaceType` field is `SPACE`. If the existing space has a target audience, you can remove the audience and restrict space access by omitting a value for this field mask. To update access settings for a space, the authenticating user must be a space manager and omit all other field masks in your request. You can't update this field if the space is in [import mode](https://developers.google.com/workspace/chat/import-data-overview). To learn more, see [Make a space discoverable to specific users](https://developers.google.com/workspace/chat/space-target-audience). `access_settings.audience` is not supported with `useAdminAccess`. `permission_settings`: Supports changing the [permission settings](https://support.google.com/chat/answer/13340792) of a space. When updating permission settings, you can only specify `permissionSettings` field masks; you cannot update other field masks at the same time. `permissionSettings` is not supported with `useAdminAccess`. The supported field masks include: - `permission_settings.manageMembersAndGroups` - `permission_settings.modifySpaceDetails` - `permission_settings.toggleHistory` - `permission_settings.useAtMentionAll` - `permission_settings.manageApps` - `permission_settings.manageWebhooks` - `permission_settings.replyMessages`
useAdminAccess: boolean, Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.spaces` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). Some `FieldMask` values are not supported using admin access. For details, see the description of `update_mask`.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}</pre>
</div>
<div class="method">
<code class="details" id="search">search(orderBy=None, pageSize=None, pageToken=None, query=None, useAdminAccess=None, x__xgafv=None)</code>
<pre>Returns a list of spaces in a Google Workspace organization based on an administrator's search. In the request, set `use_admin_access` to `true`. For an example, see [Search for and manage spaces](https://developers.google.com/workspace/chat/search-manage-admin). Requires [user authentication with administrator privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges) and one of the following [authorization scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.admin.spaces.readonly` - `https://www.googleapis.com/auth/chat.admin.spaces`
Args:
orderBy: string, Optional. How the list of spaces is ordered. Supported attributes to order by are: - `membership_count.joined_direct_human_user_count` — Denotes the count of human users that have directly joined a space. - `last_active_time` — Denotes the time when last eligible item is added to any topic of this space. - `create_time` — Denotes the time of the space creation. Valid ordering operation values are: - `ASC` for ascending. Default value. - `DESC` for descending. The supported syntax are: - `membership_count.joined_direct_human_user_count DESC` - `membership_count.joined_direct_human_user_count ASC` - `last_active_time DESC` - `last_active_time ASC` - `create_time DESC` - `create_time ASC`
pageSize: integer, The maximum number of spaces to return. The service may return fewer than this value. If unspecified, at most 100 spaces are returned. The maximum value is 1000. If you use a value more than 1000, it's automatically changed to 1000.
pageToken: string, A token, received from the previous search spaces call. Provide this parameter to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results.
query: string, Required. A search query. You can search by using the following parameters: - `create_time` - `customer` - `display_name` - `external_user_allowed` - `last_active_time` - `space_history_state` - `space_type` `create_time` and `last_active_time` accept a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported comparison operators are: `=`, `<`, `>`, `<=`, `>=`. `customer` is required and is used to indicate which customer to fetch spaces from. `customers/my_customer` is the only supported value. `display_name` only accepts the `HAS` (`:`) operator. The text to match is first tokenized into tokens and each token is prefix-matched case-insensitively and independently as a substring anywhere in the space's `display_name`. For example, `Fun Eve` matches `Fun event` or `The evening was fun`, but not `notFun event` or `even`. `external_user_allowed` accepts either `true` or `false`. `space_history_state` only accepts values from the [`historyState`] (https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.HistoryState) field of a `space` resource. `space_type` is required and the only valid value is `SPACE`. Across different fields, only `AND` operators are supported. A valid example is `space_type = "SPACE" AND display_name:"Hello"` and an invalid example is `space_type = "SPACE" OR display_name:"Hello"`. Among the same field, `space_type` doesn't support `AND` or `OR` operators. `display_name`, 'space_history_state', and 'external_user_allowed' only support `OR` operators. `last_active_time` and `create_time` support both `AND` and `OR` operators. `AND` can only be used to represent an interval, such as `last_active_time < "2022-01-01T00:00:00+00:00" AND last_active_time > "2023-01-01T00:00:00+00:00"`. The following example queries are valid: ``` customer = "customers/my_customer" AND space_type = "SPACE" customer = "customers/my_customer" AND space_type = "SPACE" AND display_name:"Hello World" customer = "customers/my_customer" AND space_type = "SPACE" AND (last_active_time < "2020-01-01T00:00:00+00:00" OR last_active_time > "2022-01-01T00:00:00+00:00") customer = "customers/my_customer" AND space_type = "SPACE" AND (display_name:"Hello World" OR display_name:"Fun event") AND (last_active_time > "2020-01-01T00:00:00+00:00" AND last_active_time < "2022-01-01T00:00:00+00:00") customer = "customers/my_customer" AND space_type = "SPACE" AND (create_time > "2019-01-01T00:00:00+00:00" AND create_time < "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF") ```
useAdminAccess: boolean, When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). This method currently only supports admin access, thus only `true` is accepted for this field.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response with a list of spaces corresponding to the search spaces request.
"nextPageToken": "A String", # A token that can be used to retrieve the next page. If this field is empty, there are no subsequent pages.
"spaces": [ # A page of the requested spaces.
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
},
],
"totalSize": 42, # The total number of spaces that match the query, across all pages. If the result is over 10,000 spaces, this value is an estimate.
}</pre>
</div>
<div class="method">
<code class="details" id="search_next">search_next()</code>
<pre>Retrieves the next page of results.
Args:
previous_request: The request for the previous page. (required)
previous_response: The response from the request for the previous page. (required)
Returns:
A request object that you can call 'execute()' on to request the next
page. Returns None if there are no more items in the collection.
</pre>
</div>
<div class="method">
<code class="details" id="setup">setup(body=None, x__xgafv=None)</code>
<pre>Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see [Set up a space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). To specify the human members to add, add memberships with the appropriate `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user@example.com` or `users/123456789`. To specify the Google groups to add, add memberships with the appropriate `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud Identity Groups lookup API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID `123456789` for group email `group@example.com`, then you can add the group to the space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not supported, and Google groups can only be added as members in named spaces. For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn't have permission to add some members, then those members aren't added to the created space. To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created. To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to `true` and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](https://developers.google.com/workspace/chat/create-members). If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned. Spaces with threaded replies aren't supported. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following [authorization scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.spaces.create` - `https://www.googleapis.com/auth/chat.spaces`
Args:
body: object, The request body.
The object takes the form of:
{ # Request to create a space and add specified users to it.
"memberships": [ # Optional. The Google Chat users or groups to invite to join the space. Omit the calling user, as they are added automatically. The set currently allows up to 49 memberships (in addition to the caller). For human membership, the `Membership.member` field must contain a `user` with `name` populated (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only add human users when setting up a space (adding Chat apps is only supported for direct message setup with the calling app). You can also add members using the user's email as an alias for {user}. For example, the `user.name` can be `users/example@gmail.com`. To invite Gmail users or users from external Google Workspace domains, user's email must be used for `{user}`. For Google group membership, the `Membership.group_member` field must contain a `group` with `name` populated (format `groups/{group}`). You can only add Google groups when setting `Space.spaceType` to `SPACE`. Optional when setting `Space.spaceType` to `SPACE`. Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at least two memberships. Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human user, along with exactly one membership. Must be empty when creating a 1:1 conversation between a human and the calling Chat app (when setting `Space.spaceType` to `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`).
{ # Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
"createTime": "A String", # Optional. Immutable. The creation time of the membership, such as when a member joined or was invited to join a space. This field is output only, except when used to import historical memberships in import mode spaces.
"deleteTime": "A String", # Optional. Immutable. The deletion time of the membership, such as when a member left or was removed from a space. This field is output only, except when used to import historical memberships in import mode spaces.
"groupMember": { # A Google Group in Google Chat. # Optional. The Google Group the membership corresponds to. Reading or mutating memberships for Google Groups requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"name": "A String", # Resource name for a Google Group. Represents a [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in Cloud Identity Groups API. Format: groups/{group}
},
"member": { # A user in Google Chat. When returned as an output from a request, if your Chat app [authenticates as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), the output for a `User` resource only populates the user's `name` and `type`. # Optional. The Google Chat user or app the membership corresponds to. If your Chat app [authenticates as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), the output populates the [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) `name` and `type`.
"displayName": "A String", # Output only. The user's display name.
"domainId": "A String", # Unique identifier of the user's Google Workspace domain.
"isAnonymous": True or False, # Output only. When `true`, the user is deleted or their profile is not visible.
"name": "A String", # Resource name for a Google Chat user. Format: `users/{user}`. `users/app` can be used as an alias for the calling app bot user. For human users, `{user}` is the same user identifier as: - the `id` for the [Person](https://developers.google.com/people/api/rest/v1/people) in the People API. For example, `users/123456789` in Chat API represents the same person as the `123456789` Person profile ID in People API. - the `id` for a [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Admin SDK Directory API. - the user's email address can be used as an alias for `{user}` in API requests. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can use `users/user@example.com` as an alias to reference `users/123456789`. Only the canonical resource name (for example `users/123456789`) will be returned from the API.
"type": "A String", # User type.
},
"name": "A String", # Identifier. Resource name of the membership, assigned by the server. Format: `spaces/{space}/members/{member}`
"role": "A String", # Optional. User's role within a Chat space, which determines their permitted actions in the space. This field can only be used as input in `UpdateMembership`.
"state": "A String", # Output only. State of the membership.
},
],
"requestId": "A String", # Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.
"space": { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app. # Required. The `Space.spaceType` field is required. To create a space, set `Space.spaceType` to `SPACE` and set `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. To create a group chat, set `Space.spaceType` to `GROUP_CHAT`. Don't set `Space.displayName`. To create a 1:1 conversation between humans, set `Space.spaceType` to `DIRECT_MESSAGE` and set `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or `Space.spaceDetails`. To create an 1:1 conversation between a human and the calling Chat app, set `Space.spaceType` to `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or `Space.spaceDetails`. If a `DIRECT_MESSAGE` space already exists, that space is returned instead of creating a new space.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
},
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
"accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
"accessState": "A String", # Output only. Indicates the access state of the space.
"audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
},
"adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
"createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
"customer": "A String", # Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. For DMs, this field isn't populated.
"displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
"externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
"importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
"importModeExpireTime": "A String", # Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode.
"lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
"membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
"joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
"joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
},
"name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
"permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings. Reading and updating permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
"useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
"managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
"membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
},
},
"predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field. Setting predefined permission settings supports: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
"singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
"spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
"description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
"guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
},
"spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
"spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
"spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
"spaceUri": "A String", # Output only. The URI for a user to access the space.
"threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
"type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}</pre>
</div>
</body></html>
|