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 service 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
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.
Posted by Anuj Gulati, Developer Marketing Manager, Google Play and Sami Kizilbash, Developer Relations Program Manager, Google
Emerging markets now account for more than 40% of game installs on Google Play. Rapid smartphone adoption in these regions presents a new base of engaged gamers that are looking for high quality mobile gaming experiences. At Google Play, we are focused on helping local game developers from these markets achieve their full potential and make the most of this opportunity.
Indie Games Accelerator is a new initiative to support top indie game startups from India, Indonesia, Malaysia, Pakistan, Philippines, Singapore, Thailand and Vietnam who are looking to supercharge their growth on Android. This four month program is a special edition of Launchpad Accelerator, designed in close collaboration with Google Play, featuring a comprehensive gaming curriculum and mentorship from top mobile gaming experts.
Successful participants will be invited to attend two all-expense-paid gaming bootcamps at the Google Asia-Pacific office in Singapore, where they will receive personalized mentorship from Google teams and industry experts. Additional benefits include Google Cloud Platform credits, invites to exclusive Google and industry events, and more.
Visit the program website to find out more and apply now.
Posted by the Flutter Team at Google
Today at the GMTC front-end conference in Beijing, we announced Flutter Release Preview 1, signaling a new phase of development for Flutter as we move into the final stages of stabilization for 1.0.
Google I/O last month was something of a celebration for the Flutter team: having reached beta, it was good to meet with many developers who are learning, prototyping, or building with Flutter. In the immediate aftermath of Google I/O, we continue to see rapid growth in the Flutter ecosystem, with a 50% increase in active Flutter users. We've also seen over 150 individual Flutter events taking place across fifty countries: from New York City to Uyo, Nigeria; from Tokyo and Osaka in Japan to Nuremberg, Germany.
One common measure of community momentum is the number of GitHub stars, and we've also seen tremendous growth here, with Flutter becoming one of the top 100 software repos on GitHub in May.
Today we're taking another big step forward, with the immediate availability of Flutter Release Preview 1. It seems particularly auspicious to make this announcement in Beijing at the GMTC Global Front-End Conference. China has the third largest population of developers using Flutter, after the USA and India. Companies such as Alibaba and Tencent are already adopting Flutter for production apps, and there is a growing local community who are translating content and adding packages and mirrors for Chinese developers.
The shift from beta to release preview with this release signals our confidence in the stability and quality of what we have with Flutter, and our focus on bug fixing and stabilization.
We've posted a longer article with details on what's new in Flutter Release Preview 1 over at our Medium channel. You can download Flutter Release Preview 1 directly from the Flutter website, or simply run flutter upgrade from an existing installation.
flutter upgrade
It's been fun to watch others encounter Flutter for the first time. This article from an iOS developer who has recently completed porting an iOS app to Flutter is a positive endorsement of the project's readiness for real-world production usage:
"I haven't been this excited about a technology since Ruby on Rails or Go… After dedicating years to learning iOS app dev in-depth, it killed me that I was alienating so many Android friends out there. Also, learning other cross platform frameworks at the time was super unattractive to me because of what was available… Writing a Flutter app has been a litmus test and Flutter passed the test. Flutter is something I feel like I can really invest in and most importantly, really enjoy using."
As we get ever closer to publishing our first release from the "stable" channel, we're ready for more developers to build and deploy solutions that use this Release Preview. There are plenty of training offerings to help you learn Flutter: from I/O sessions to newsletters to hands-on videos to developer shows. We're excited to see what you build!
Posted by Amit Chopra & Maggie Hohlfeld
2 years, 225+ agencies and 36 countries later, the Google Developers Agency Program has grown from a simple effort to connect with development agencies working on mobile apps to a global, exclusive program that recognizes and trains the best software agencies in the world.
The program's mission remains simple: identify, upskill, and promote top development agencies. It provides agencies with access to local events, hangouts, dedicated content, priority support from product and developer relations teams, and upcoming developer products.
As a way to identify top agencies who demonstrated excellence in Android development within the program and promote them, we first announced the "Certified Agency" Program at Google I/O in May 2015. Certification has now become the gold standard for Android development agencies, and has helped to push the agency ecosystem to improve as a whole.
Today we are pleased to share that we now have reached 50 Certified agencies from 15 different countries in the program.
We celebrated our newest class of Certified agencies at Google I/O, where it all began, and can't wait to see how much the program will have grown by this time next year.
Learn more about the program by clicking on Google Developers Agency program.