Tag Archives: Hangouts Chat

Hangouts Chat alerts & notifications… with asynchronous messages

Posted by Wesley Chun (@wescpy), Developer Advocate, G Suite

While most chatbots respond to user requests in a synchronous way, there are scenarios when bots don't perform actions based on an explicit user request, such as for alerts or notifications. In today's DevByte video, I'm going to show you how to send messages asynchronously to rooms or direct messages (DMs) in Hangouts Chat, the team collaboration and communication tool in G Suite.

What comes to mind when you think of a bot in a chat room? Perhaps a user wants the last quarter's European sales numbers, or maybe, they want to look up local weather or the next movie showtime. Assuming there's a bot for whatever the request is, a user will either send a direct message (DM) to that bot or @mention the bot from within a chat room. The bot then fields the request (sent to it by the Hangouts Chat service), performs any necessary magic, and responds back to the user in that "space," the generic nomenclature for a room or DM.

Our previous DevByte video for the Hangouts Chat bot framework shows developers what bots and the framework are all about as well as how to build one of these types of bots, in both Python and JavaScript. However, recognize that these bots are responding synchronously to a user request. This doesn't suffice when users want to be notified when a long-running background job has completed, when a late bus or train will be arriving soon, or when one of their servers has just gone down. Recognize that such alerts can come from a bot but also perhaps a monitoring application. In the latest episode of the G Suite Dev Show, learn how to integrate this functionality in either type of application.

From the video, you can see that alerts and notifications are "out-of-band" messages, meaning they can come in at any time. The Hangouts Chat bot framework provides several ways to send asynchronous messages to a room or DM, generically referred to as a "space." The first is the HTTP-based REST API. The other way is using what are known as "incoming webhooks."

The REST API is used by bots to send messages into a space. Since a bot will never be a human user, a Google service account is required. Once you create a service account for your Hangouts Chat bot in the developers console, you can download its credentials needed to communicate with the API. Below is a short Python sample snippet that uses the API to send a message asynchronously to a space.

from apiclient import discovery
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials

SCOPES = 'https://www.googleapis.com/auth/chat.bot'
creds = ServiceAccountCredentials.from_json_keyfile_name(
'svc_acct.json', SCOPES)
CHAT = discovery.build('chat', 'v1', http=creds.authorize(Http()))

room = 'spaces/<ROOM-or-DM>'
message = {'text': 'Hello world!'}
CHAT.spaces().messages().create(parent=room, body=message).execute()

The alternative to using the API with services accounts is the concept of incoming webhooks. Webhooks are a quick and easy way to send messages into any room or DM without configuring a full bot, i.e., monitoring apps. Webhooks also allow you to integrate your custom workflows, such as when a new customer is added to the corporate CRM (customer relationship management system), as well as others mentioned above. Below is a Python snippet that uses an incoming webhook to communicate into a space asynchronously.

import requests
import json

URL = 'https://chat.googleapis.com/...&thread_key=T12345'
message = {'text': 'Hello world!'}
requests.post(URL, data = json.dumps(message))

Since incoming webhooks are merely endpoints you HTTP POST to, you can even use curl to send a message to a Hangouts Chat space from the command-line:

curl \
-X POST \
-H 'Content-Type: application/json' \
'https://chat.googleapis.com/...&thread_key=T12345' \
-d '{"text": "Hello!"}'

To get started, take a look at the Hangouts Chat developer documentation, especially the specific pages linked to above. We hope this video helps you take your bot development skills to the next level by showing you how to send messages to the Hangouts Chat service asynchronously.

Bring teams together with new G Suite integrations

(Cross-posted from The Keyword)



The average employee uses 36 cloud services at work to collaborate or share files. That’s more apps than hours in a day! With so many apps and services, it’s important that your business chooses modern, open tools that make it easy to work with anyone—be it inside or outside of your organization.

We want to reduce complexity for your teams, which is why we’ve built integrations in G Suite like third-party add-ons in Gmail and Google Docs and better interoperability with Microsoft. Today, we’re announcing new integrations in Hangouts Meet and Calendar to help you have even better meeting experiences regardless of the conference technology you use. We’re also bringing you new ways to collaborate in Hangouts Chat and Sheets.

Collaborate easily with new compatibility in Hangouts Meet

Nothing’s more frustrating than hosting a meeting and having trouble getting people to join because of issues with technology—it can interrupt workflows and slow down productivity. We want to make it easier for businesses to use meeting solutions, like Hangouts Meet, without worrying about compatibility with existing equipment. This is why we’re making Meet compatible with traditional video conferencing systems, like Polycom and Cisco. In partnership with Pexip, teams will be able to join a meeting on Meet from their preferred equipment in the coming weeks. We’re also making it possible for Microsoft Skype for Business users to easily join a meeting on Meet directly from their Skype app.

Spotify has benefited from using Hangouts Meet to collaborate both internally and externally. Says Martin Antonsson, AV Infrastructure Engineer at Spotify, “Interoperability between Hangouts Meet and other video conferencing systems is fundamental to enabling collaboration. Now we can focus on having productive meetings instead of worrying about the technology.”

 Build add-ons in Google Calendar, join meetings in a cinch

A big part of having productive meetings is making sure that the right folks are able to join them. That’s why we’re announcing support for third-party conferencing natively in Google Calendar. Soon conference providers can easily build add-ons to create, view and join a video conference directly from a Calendar event. Users can simply click a link in the Calendar invite to join on web or mobile.



Cisco Webex is building an add-on to help users easily schedule meetings right from Google Calendar without requiring a download or plug-in. Arkadin, GoToMeeting, LogMeIn, Dialpad, RingCentral, Vidyo and Vonage are also building add-ons to help them more easily meet with their customers. These third-party conferencing add-ons will be available in the G Suite Marketplace in the coming months with details to come for developers.

You might have seen that we made it easier to view schedule availability across Google Calendar and Microsoft Exchange last year. Building on this, we’re also announcing a way for you to book resources like rooms, equipment and more in Microsoft Exchange. If you use G Suite, you’ll be able to easily view and book resources stored in Exchange and Office 365 in the coming months.

Work with teams outside of your domain in Hangouts Chat

After you get the right people in the room with the right setup, it’s important to be able to share information in real time during your meetings—even with folks who may not be in your company. In the coming months, you’ll be able to include people from outside of your organization in Chat, making it easy to stay aligned with clients, vendors, partners and others, all from one place.

Resuelve—a consumer debt management business based in Mexico—uses guest access in Chat to connect with people outside of their organization, particularly as they look to grow their presence in additional regions. "Hangouts Chat has been crucial to our company's ability to expand into other markets,” says Jordi Adame, Chief Technology Officer of Resuelve. “It’s helped our internal teams be productive and we're looking forward to connecting with people outside of our organization in a similarly efficient way.”

New SAP integrations with Google Sheets

Companies often have critical business data in their SAP systems. In an upcoming SAP release, employees will be able to discover additional insights from their ERP content by importing it directly into Google Sheets. With this new integration, you can skip manually exporting data to CSVs and uploading them to Drive. Instead, export directly to Sheets and analyze data with tools like intelligent pivot tables. You can also skip tedious formatting by recording macros in Sheets, making it easier to streamline business processes and share information across teams right away.



Looking ahead

In the coming months, you’ll be able to join conferences on Hangouts Meet from your existing meeting room hardware, book rooms from Microsoft Exchange in Google Calendar and collaborate with folks outside of your domain in Hangouts Chat. You’ll also start to see integrations with Google Sheets in an upcoming SAP release, too.

Learn more about how your business’ technology can co-exist with G Suite. Visit the Next ‘18 website to register.

Developing bots for Hangouts Chat

Posted by Wesley Chun (@wescpy), Developer Advocate, G Suite

We recently introduced Hangouts Chat to general availability. This next-generation messaging platform gives G Suite users a new place to communicate and to collaborate in teams. It features archive & search, tighter G Suite integration, and the ability to create separate, threaded chat rooms. The key new feature for developers is a bot framework and API. Whether it's to automate common tasks, query for information, or perform other heavy-lifting, bots can really transform the way we work.

In addition to plain text replies, Hangouts Chat can also display bot responses with richer user interfaces (UIs) called cards which can render header information, structured data, images, links, buttons, etc. Furthermore, users can interact with these components, potentially updating the displayed information. In this latest episode of the G Suite Dev Show, developers learn how to create a bot that features an updating interactive card.

As you can see in the video, the most important thing when bots receive a message is to determine the event type and take the appropriate action. For example, a bot will perform any desired "paperwork" when it is added to or removed from a room or direct message (DM), generically referred to as a "space" in the vernacular.

Receiving an ordinary message sent by users is the most likely scenario; most bots do "their thing" here in serving the request. The last event type occurs when a user clicks on an interactive card. Similar to receiving a standard message, a bot performs its requisite work, including possibly updating the card itself. Below is some pseudocode summarizing these four event types and represents what a bot would likely do depending on the event type:

function processEvent(req, rsp) {
var event = req.body; // event type received
var message; // JSON response message

if (event.type == 'REMOVED_FROM_SPACE') {
// no response as bot removed from room
return;

} else if (event.type == 'ADDED_TO_SPACE') {
// bot added to room; send welcome message
message = {text: 'Thanks for adding me!'};

} else if (event.type == 'MESSAGE') {
// message received during normal operation
message = responseForMsg(event.message.text);

} else if (event.type == 'CARD_CLICKED') {
// user-click on card UI
var action = event.action;
message = responseForClick(
action.actionMethodName, action.parameters);
}

rsp.send(message);
};

The bot pseudocode as well as the bot featured in the video respond synchronously. Bots performing more time-consuming operations or those issuing out-of-band notifications, can send messages to spaces in an asynchronous way. This includes messages such as job-completed notifications, alerts if a server goes down, and pings to the Sales team when a new lead is added to the CRM (Customer Relationship Management) system.

Hangouts Chat supports more than JavaScript or Python and Google Apps Script or Google App Engine. While using JavaScript running on Apps Script is one of the quickest and simplest ways to get a bot online within your organization, it can easily be ported to Node.js for a wider variety of hosting options. Similarly, App Engine allows for more scalability and supports additional languages (Java, PHP, Go, and more) beyond Python. The bot can also be ported to Flask for more hosting options. One key takeaway is the flexibility of the platform: developers can use any language, any stack, or any cloud to create and host their bot implementations. Bots only need to be able to accept HTTP POST requests coming from the Hangouts Chat service to function.

At Google I/O 2018 last week, the Hangouts Chat team leads and I delivered a longer, higher-level overview of the bot framework. This comprehensive tour of the framework includes numerous live demos of sample bots as well as in a variety of languages and platforms. Check out our ~40-minute session below.

To help you get started, check out the bot framework launch post. Also take a look at this post for a deeper dive into the Python App Engine version of the vote bot featured in the video. To learn more about developing bots for Hangouts Chat, review the concepts guides as well as the "how to" for creating bots. You can build bots for your organization, your customers, or for the world. We look forward to all the exciting bots you're going to build!

Hangouts Chat now generally available

We just announced some new G Suite products and features to help your organization collaborate more effectively and efficiently. As part of that announcement, we introduced Hangouts Chat as a core service. Below are some admin-specific details about Hangouts Chat to help you get started.

The Hangouts Chat service will launch default on, unless you’ve chosen to manually opt in to new services. To start using Hangouts Chat on the web, go to https://chat.google.com. To download the app on your desktop or mobile device, go to https://get.google.com/chat.

Please note:
  • If you currently have forced chat history off, you will need to actively enable Hangouts Chat in your Admin console regardless of your setting for opting in to new services. This is because “room” conversations in Chat always retain Chat history, regardless of your settings, so it's important that you understand this before enabling the service.
  • If both classic Hangouts and the new Hangouts Chat are enabled for an organizational unit (OU), the classic Hangouts history on or off settings are used in chats in which participants use a mix of classic and new Chat. If the history settings are different for chat participants of different OUs, the chat conversation can’t be created. Please review your chat history settings for both products (more info).
  • If your domain participated in the Hangouts Chat Early Adopter Program, your settings will be retained. These settings will be accessible at Apps > G Suite > Hangouts Chat in the Admin console.
Hangouts Chat is compatible with the classic version of Hangouts, and you’ll still be able to use classic Hangouts—making sure you don’t miss a message from anyone in your organization. All one-to-one direct messages will forward both ways between Hangouts Chat and classic Hangouts by default.

Additionally, if you require Vault support for use of Hangouts Chat, please see our post for details on that launch.

If you have any further questions, check out the get started guide or visit the Help Center.

Launch Details
Release track:
Launching to both Rapid Release and Scheduled Release

Editions:
Available to all G Suite editions except Government

Rollout pace:
Gradual rollout (up to 15 days for feature visibility)

Impact:
All end users

Action:
Change management suggested/FYI

More Information
Help Center: Turn Hangouts Chat on or off
Help Center: Sign in to Hangouts Chat
Help Center: About bots
The Keyword: New ways to help teams work faster and smarter with G Suite
The Keyword: Move projects forward from one place—Hangouts Chat now available
The Keyword: Meet the new Hangouts
G Suite Updates: Google Vault support for Hangouts Chat


Launch release calendar
Launch detail categories
Get these product update alerts by email
Subscribe to the RSS feed of these updates

Google Vault support for Hangouts Chat

We just announced some new G Suite products and features to help your organization collaborate more effectively and efficiently. As part of that announcement, we introduced Google Vault support for Hangouts Chat. Below are some admin-specific details to help you get started.

The newly launched Hangouts Chat is an intelligent and secure tool that makes team collaboration easy. An enterprise-ready solution, Hangouts Chat gives G Suite admins the governance controls they need to manage and secure their organization’s data, including full support in Google Vault—a tool that can help with their eDiscovery and compliance needs.

Set retention policies for Hangouts Chat messages
As a G Suite admin, you can now set retention policies that apply to all Hangouts Chat messages, including those sent directly and those sent in rooms.

You can set a default rule that applies to all users in your domain. This can be an indefinite retention policy (such that messages are never expunged), or one that expunges messages at the end of a specific time period. The default rule applies to all direct messages and rooms in your domain.

You can also set custom retention rules for specific organizational units (OUs), which apply to direct messages only, and/or for all rooms, which apply to room conversations only. This allows you to manage the lifecycle of direct and room messages separately. Custom rules override the default rule and, if multiple custom rules apply to a message, the rule with the longest retention coverage period takes precedence.


Place legal holds on Hangouts Chat messages
In addition to setting retention policies, you can now place legal holds on your employees' Hangouts Chat conversations, whether they take place via direct message or in rooms.

Doing so will preserve room conversations in which a held user is a participant (i.e. they’ve sent a message) and direct messages in which a held user is a member (i.e. they’ve sent or received a message), regardless of whether that user deletes those messages. If a user on hold deletes a message, it will appear deleted to them—but it will be available in Vault until the hold is removed. Remember that holds always take precedence over retention rules.


Search, preview and export chat content 
Finally, you can now search, preview, and export your employees’ Hangouts Chat messages. This enables you to apply the same eDiscovery programs you use for other G Suite services (like Gmail and Drive) to content stored in Hangouts Chat direct messages and rooms.


To learn more about how Vault's support for Hangouts Chat can help your organization meet its legal obligations and archiving needs, check out the Vault Help Center.

Launch Details
Release track:
Launching to both Rapid Release and Scheduled Release

Editions:
Available to G Suite Business, Enterprise, and Education editions only

Rollout pace:
Gradual rollout (up to 15 days for feature visibility)

Impact:
Admins only

Action:
Admin action suggested/FYI

More Information
Help Center: Google Vault
Help Center: Supported data types
The Keyword: New ways to help teams work faster and smarter with G Suite
The Keyword: Move projects forward from one place—Hangouts Chat now available
G Suite Updates: Hangouts Chat now generally available



Launch release calendar
Launch detail categories
Get these product update alerts by email
Subscribe to the RSS feed of these updates

Hangouts Meet now publicly available and Hangouts Chat Early Adopter Program now accepting applications

Earlier today, we announced the public launch of Hangouts Meet and the Early Adopter Program for Hangouts Chat, the new enterprise-focused video meetings and online messaging experiences coming to Google Hangouts. Learn more about the new Hangouts in our blog post here: Meet the new Hangouts.

Getting started with Meet

If you are a G Suite administrator, the ability to enable specific organizational units for Meet or even your entire domain is gradually rolling out starting today.
Because Meet is launching default off for existing Hangouts users, you have the flexibility and control to plan and coordinate the rollout of Meet with your team and users.

Applying for early access to Chat

Launch Details

Release track:
Launching to both Rapid release and Scheduled release

Editions:
Meet is now available to all G Suite editions; however, the ability to create meetings with a dial-in phone number is only available to Enterprise edition users

Rollout pace:
Gradual rollout (potentially longer than 3 days for feature visibility)

Impact:
Admins only
For existing domains, Admins can choose when to enable Google Meet for their users.
For newly created domains, Google Meet will be enabled by default.

Action:
Admin action suggested/FYI

More Information
Help Center: Enable the new Hangouts video meetings experience (Administrators)
Help Center: Create or join a new Hangouts video meetings experience (End-users)
Hangouts Meet Learning Center (End-users)
The Keyword