Unleash the power of random in Google Chat
Tags: githubhack23, javascript, chatgpt, googlechat
Published: 2023-05-23 00:55:08

## What I built 
RandomBot is a Google Chat Apps that allow you to avoid the stress of making a choice.

In addition, RandomBot is capable of providing motivations, quotes, and recommendations for anything.

### Category Submission: 
Wacky Wildcards

### App Link
https://workspace.google.com/marketplace/app/randombot/667006205564 
As of May 23nd, the app is still pending approval. Once it is approved, anyone will be able to access the app through the provided link. Alternatively, you can install it directly in your Google Chat space by searching for "RandomBot" in the "Find Apps" menu.

Based on my previous experience, each review used to take only one working day (even if there were rejections). I'm not sure why it's taking longer now.

### Screenshots 

![Random from mentioned message animation](https://raw.githubusercontent.com/dyaskur/google-chat-shuffler/master/assets/screenshot.gif)
![Random Members](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ov6aqjeain3oyn8kmv27.png)
![Using Random GPT](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iin1orgtclgfxbsc6xq7.png)

### Description 
We often struggle with making choices and end up wasting time contemplating our options.

Instead of experiencing the stress of making a choice, it is preferable to simply randomize these choices.

This app is also powered by ChatGPT, which allows you to randomly get various things using GPT commands. You can obtain quotes, motivations, jokes, places to visit, numbers, and more.

### Link to Source Code 
https://github.com/dyaskur/google-chat-shuffler

### Permissive License 
[MIT License](https://github.com/dyaskur/google-chat-shuffler/blob/master/LICENCE.md)

## Background (What made you decide to build this particular app? What inspired you?) 

After conducting retrospectives every two weeks, our team uses a website called "Wheel of Name" to randomly select team members who will write the retrospective summaries. However, we face some challenges as the main computer used for screen sharing is a random company device that doesn't have previous logs. As a result, team members need to write down all the names every time they use the "Wheel of Name" website. Additionally, we sometimes forget who wrote the summaries in the previous week.

To address this issue, I propose creating a Google Chat app that can solve these problems. By utilizing RandomBot, we can quickly spin all Google Chat space members and maintain a log to track the writer of the previous week. This app will also offer other useful features to enhance our communication and collaboration.

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?) 

Since Google Chat app lacks dynamic styles like HTML5 or CSS, I faced some challenges in finding ideas to make it engaging and fun, similar to the "Wheel of Name" concept. 

Initially, I had planned to use a loop to update the message and make it look more engaging and prettier. However, due to the limited quota for Google Chat API calls, I had to explore alternative solutions.

Fortunately, I came up with an idea by using GIF animations to add an element of fun. To implement this idea, I developed a [GIF generator](https://github.com/dyaskur/google-chat-shuffler/blob/master/image_generator.js) for my app. Hopefully it makes my app more fun.

I built it using Google Cloud Functions with the latest ECMAScript version. Additionally, I utilized Google Cloud Tasks(similar to AWS SQS) to update the message after the random GIF animation is complete.

I have learned a lot about how to use ECMAScript when I build this app. Previously, I also created a [Google Chat Poll](https://github.com/dyaskur/google-chat-poll) app using CommonJS, which is a different module system compared to ECMAScript.

For continuous integration and deployment, I implemented GitHub Actions, which allows me to automate the process. It also sends the test coverage report to Coveralls, enabling me to view the percentage of test coverage through a repository badge.

And this is my first time using GitHub Actions to deploy to Google Cloud Function, so I made several test commits to learn the process. Initially, I deployed after the CI Build workflow ran, but after careful consideration, I decided to deploy only on the published release event.

### Additional Resources/Info

https://randombot.yaskur.com - the RandomBot landing page, just made it to formality for google approval
https://absolute-poll.yaskur.com - my another google chat app that used by more than 25k users.