Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Switching presence automatically with the Chat API: conditions for muting notifications

Table of contents · 7 items

Google Chat notifications keep arriving just when you want to focus on preparing documents or calculating a quote. Even if you put "focus time" on your calendar, Chat still shows you as "online." When you finish, you forget to turn off "do not disturb" and miss an urgent message. This article is for people wondering whether this switching could be done automatically according to calendar events.

The Google Chat API has a resource called users.availability that handles a user's availability. It includes operations to switch the state to "active," "away" or "do not disturb," and to set a custom status such as "Preparing documents." The Chat API release notes announced it as generally available (GA) on July 7, 2026. Based on the release notes, the "Manage user availability for Chat apps" guide, the reference for each method and the Chat API Discovery document (the machine-readable definition of the API, revision 20261013), this article sorts out the conditions you should know before automating.

You can change only "your own" status

The first point to understand is that this API can handle only the status of the authenticated user. Each method's description includes the following sentence.

This method only updates the authenticated user’s availability.

The read method get is also described as "gets only the availability of the authenticated user," and the guide likewise says "you can only read and write the availability of the authenticated user." The resource name format is users/{user}/availability, and besides users/me you can write an email address or user ID, but that does not mean you can read or write other people's status. Design on the assumption that it cannot be used for dashboards listing the whole team's availability or for administrators changing members' statuses in bulk.

Authentication is user authentication, with the following two scopes. The guide's prerequisites list a Business or Enterprise Google Workspace account with access to Google Chat.

  • chat.users.availability: view and change availability
  • chat.users.availability.readonly: view availability only

Four states and the methods that switch them

The availability state has the following four values (plus unspecified). All are output-only; instead of writing them directly, you switch them with methods.

StatusDefinition (summary)Method that switches to it
ACTIVEActive based on recent activitymarkAsActive (expiration optional; 30 minutes if omitted)
IDLENo activity for a while after being active(not specified from the API)
AWAYAway. Set automatically when there is no activity, and can also be set manuallymarkAsAway
DO_NOT_DISTURBDo not disturb. Set manuallymarkAsDoNotDisturb (expiration required)

The reference describes the rules for each as follows.

  • markAsDoNotDisturb: mutes until the expiration. The expiration is required and is specified either as a duration from now (ttl) or as an absolute time (expireTime). The expiration can be at most one year ahead. After it passes, the state becomes away (Away). It is described as "while in do not disturb, notifications are usually not delivered"
  • markAsAway: sets the state to away. Away set this way does not change even if the user is active
  • markAsActive: sets the state to active until the expiration. The expiration is optional; if omitted, it expires after 30 minutes. When it expires, the state becomes away. However, while the user is using Chat, active may continue past the expiration

For automating focus time, you mainly use markAsDoNotDisturb. Because the expiration is required, it is designed so that forgetting to turn off mute is unlikely. Note, however, that after the expiration the state becomes away, not active.

Overview of Google Chat API availability. markAsDoNotDisturb mutes until an expiration (up to one year ahead), markAsAway sets away that does not change with activity, and markAsActive returns to away when it expires. Custom status is the only field that patch can change; the text is up to 64 characters and emoji must be Unicode only. Every method handles only the authenticated user's own status

Rules for custom status

Of the availability fields, only the custom status (customStatus) can be changed with patch. updateMask is also defined as accepting only custom_status. The custom status fields are as follows.

  • text (required): the status text. Up to 64 characters
  • emoji (required): the emoji. Unicode emoji only; custom emoji cannot be used
  • ttl: the duration until expiration (input-only)
  • expireTime: the expiration time

Including the time you will be back in the text, such as "Preparing documents (until 12:00)," makes it easier for others to decide whether to wait for a reply. According to the guide, to clear the custom status, you update it with customStatus omitted.

An example of linking with Calendar

From here on is the editorial team's suggestion. One approach is to put a "focus time" event on Google Calendar and, when it starts, set mute and a custom status until the event ends. The editorial team type-checked the following code against the type definitions of @googleapis/chat 51.2.0 for Node.js and ran it with the API endpoint pointed at a local stub (a test server that returns fixed responses). We did not connect to an actual Google Chat.

import { chat_v1 } from "@googleapis/chat";

// 予定の終わり(endIso)までミュートにし、ステータスに一言を出す
export async function focusUntil(chat: chat_v1.Chat, endIso: string, text: string) {
  const name = "users/me/availability";
  await chat.users.availability.markAsDoNotDisturb({
    name,
    requestBody: { expireTime: endIso },
  });
  const { data } = await chat.users.availability.patch({
    name,
    updateMask: "custom_status",
    requestBody: {
      customStatus: { text, emoji: { unicode: "📝" }, expireTime: endIso },
    },
  });
  return data;
}

The requests that reached the stub were POST /v1/users/me/availability:markAsDoNotDisturb (with a body of expireTime) and PATCH /v1/users/me/availability?updateMask=custom_status.

There are three points to decide before building it in.

  1. Run it only with the user's consent. Because it changes the user's own status, run it authenticated as that user, within the scope they have allowed. We have not checked whether it can be run for everyone in bulk using domain-wide delegation
  2. Follow changes and cancellations of events. Decide whether to revert with markAsActive when a meeting ends early or an event is deleted. Note that markAsActive becomes away when it expires, and expires in 30 minutes if the expiration is omitted
  3. Keep a route for urgent contact. Since notifications are usually not delivered during do not disturb, make sure you can receive messages such as incident response through another route, such as phone. Note that Chat apps running with app authentication can send "forced notifications" that deliver push notifications regardless of the recipient's notification settings or mute (generally available on May 8, 2026). You can also consider whether to use this feature for your internal incident notification app

When it became available

The Chat API release notes announced the five users.availability methods as generally available (GA) on July 7, 2026. The same announcement also introduced an event that Chat apps can receive when availability changes (google.workspace.chat.availability.v1.updated in the Google Workspace Events API). Among client libraries, @googleapis/chat for Node.js supports them from 46.0.0, released on August 3, and the definition bundled with the Python client (google-api-python-client) from revision 20260809.

Other new Chat API features are covered in message search and pinning and automatic space creation. For admin settings to allow or stop Chat apps in your organization, see Chat apps are not stopped by "revoking access".

Scope of verification

On October 17, 2026, we retrieved the Google Chat API Discovery document (revision 20261013) and checked the five users.availability methods and the definitions of Availability, CustomStatus, DoNotDisturbMetadata and each request in the original. We confirmed when they were added by comparing the type definitions of @googleapis/chat 45.0.0 and 46.0.0 on npm with the definitions bundled with google-api-python-client 2.198.0 and 2.199.0 (document research). We also type-checked the code example with @googleapis/chat 51.2.0 and ran it against a local stub. On October 19, 2026, we opened the Chat API release notes, the "Manage user availability for Chat apps" guide, and the reference for users.availability and each method, checked the general availability date, whether expirations are required or optional and their defaults, the state after expiration and the required account, and reflected them in this article. We have not tested how it appears in actual Chat or how notifications are stopped.

For automating work with Google Chat or Google Calendar, contact us through our free IT and Google Workspace consultation.

References

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

The right way forward with Workspace for your company.

We organize data to migrate, sharing rules, and governance structures to map out the journey from implementation to daily operations.

  • Migration and initial setup
  • Sharing and permission organization
  • Governance structure
Consult on Workspace implementation and operations

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles by email