[PYTHON] The story of creating a "spirit and time chat room" exclusively for engineers in the company

Introduction

The story of a person who wanted to discuss and share something with other engineers in order to improve the technical capabilities of the company.

Preface

It's been about half a year since I changed jobs to the current company. As I gradually got used to the atmosphere and business of the current company, I gradually began to see the good and bad points of the company.

One of the bad things was, "I don't have much communication between engineers at this company," I thought. Many people speak cheerfully and openly, but basically they don't talk much about technology. There are occasional study sessions, but after work, the participation rate is poor and it is not very efficient in the first place.

So I asked a friend who also works in the Web industry at another company. Me: "What happens to the communication between engineers at company A?" A: "Everyone is selfish, so I'm muttering on my own chat. People who like that are actively participating. I wonder if I'll force people who don't."

I see... This may have been the discomfort of the "study session". After all, if it is a study session, people who do not participate will feel like it is bad, so it is better to feel lighter and do whatever you want.

Then, let's create something like a "room of spirit and time" where engineers can speak freely in the company chat and do not interfere with others. (Our company doesn't ignore the voices of employees who want to do it, and it's not prohibited, so it's good that you can do whatever you want.)

Chapter 1: Thinking about what you need in a chat room of spirit and time

What chat tool do you use at your company? I think there are many famous places as follows.

The image of "Slack" is excellent because the API can be used. You can do more with Slack, but unfortunately our company uses "Chatwork".

The API is also open to the public in "Chatwork", and you can do the minimum with Webhooks. >> Chatwork API documentation

It was okay to launch it in Slack, but I thought it would be easier for the tools already in use to participate, so I decided to proceed as it is.

Chapter 2: What to talk about and how to operate in the chat room of spirit and time

Well, it's good to make a chat room, but how do you start talking and how do you operate it when you make it? It's good to have a study session chat for engineers in my family before, but at first everyone mutters aggressively, but gradually moves away from the chat, and the last notification is about a year ago.

I don't want to be buried in a company without being used or used. .. ..

So if you let your bot mutter automatically on a regular basis, can you prevent daily notifications and chat rooms from being buried underneath? I thought.

However, Bot also thought that it would be meaningless to mutter meaningless words every day with Bot. What is a meaningful bot ...

Chapter 3: Thinking about meaningful bots

Meaningful bot ... Personally, I thought it would be too meaningless to tell me today's date or say hello, but I wanted to think of something useful.

When I searched for my memory there, I remembered writing an article like this on Qiita before.

>> Get Qiita trends (ranking) and send them to Slack

The above article uses Python's scraping technology to capture the Qiita trends of the day and send them to Slack. I think I should use cron to send this to the room of spirit and time every day.

--Since cron is executed every day even if no one mutters, Qiita's article will be notified to chat ――Notifications come every day, which gives you a chance to see it to kill time. --Since it is an article by Qiita, the chat room becomes a database of knowledge.

I decided to do it.

Chapter 4: Create a bot using Chatwork's API

Since the original program has already been created, all you have to do is change the Webhook part to the writing style for chatwork. See the following articles for details on the program.

>> Get Qiita trends (ranking) and send them to Slack

Chatwork can easily send notifications to a specific chat room by using {room_id} and an API token given to an individual as follows.

#Send to chatwork
payload = {}
headers = {'X-ChatWorkToken': 'xxxxxxxxx'}
url = 'https://api.chatwork.com/v2/rooms/{room_id}/messages'
payload = {'body': f'{title}[info]\n{message}\n[/info]'}
requests.post(url, headers=headers, data=payload)

Just modify the above program according to the above notation and skip it. When the program is actually executed, it becomes as above. Chatwork_-_Qiita.png

Make these executions run by cron.

** 1: Create a shell once **

#!/bin/sh
python /Users/ys/Work/get_qiita_article/get_article.py

** 2: Set up cron ** Set to run every morning at 10am (company start time)

$ crontab -e
PYTHONIOENCODING = 'utf-8'
LANG = ja_JP.UTF-8
0 10 * * * cd /Users/ys/Batch/; bash -l -c 'sh get_qiita_article.sh'

Now this program will run every morning and you'll be notified to chatwork.

Final Chapter: Create a Chat Room for Spirit and Time

Volunteers who wanted to absorb knowledge and work hard through discussions gradually gathered if they forced the notifications to be skipped. You have to learn something like "I want to try this", share ideas at development meetings, and so on. I came to talk like this.

Chatwork_-_Qiita_-_2.png

As a result, I wonder if success is okay, but personally I feel that I have achieved my purpose, so I wonder if this is okay. Because I don't talk much during work, I can chat like this and gain knowledge, so I can do it with just the right temperature. As I wrote above, even if it doesn't have a role as a chat, just moving the bot can be used as a database of knowledge, so it's fairly useful.

At the end

It means "working at a company = working with various people", so it was personally good to have the opportunity to interact in this way. (Because I have only worked for half a year, there are probably some people who don't remember their names and faces.)

Also, I can appeal to the company that I will move if I am a little. It might be interesting for new employees to do it. (maybe)

To tell the truth, I wanted to make it look like this, but it was another story that I couldn't do because of Chatwork specifications. >> Story of creating a VIP channel in in-house slack

Recommended Posts

The story of creating a "spirit and time chat room" exclusively for engineers in the company
The story of creating a VIP channel for in-house chatwork
Now in Singapore The story of creating a LineBot and wanting to do a memorable job
The story of returning to the front line for the first time in 5 years and refactoring Python Django
The story of creating a store search BOT (AI LINE BOT) for Go To EAT in Chiba Prefecture (1)
The story of creating a store search BOT (AI LINE BOT) for Go To EAT in Chiba Prefecture (2) [Overview]
Register a task in cron for the first time
The story of Airflow's webserver and DAG, which takes a long time to load
Check the processing time and the number of calls for each process in python (cProfile)
Summary of stumbling blocks in Django for the first time
The story of creating a database using the Google Analytics API
Put the process to sleep for a certain period of time (seconds) or more in Python
The story of releasing a Python text check tool on GitHub x CircleCI for the first time
The story of creating a bot that displays active members in a specific channel of slack with python
If you are a beginner in programming, why not make a "game" for the time being? The story
The story of making a standard driver for db with python.
A function that measures the processing time of a method in python
The story of creating a site that lists the release dates of books
Verify the compression rate and time of PIXZ used in practice
The story of Python and the story of NaN
The story of participating in AtCoder
The story of the "hole" in the file
The story of writing a program
A story about trying to improve the testing process of a system written in C language for 20 years
A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week
The story of a Parking Sensor in 10 minutes with GrovePi + Starter Kit
Randomly play the movie on ChromeCast for a certain period of time
The story of having a hard time introducing OpenCV with M1 MAC
The story of making a sound camera with Touch Designer and ReSpeaker
Get a datetime instance at any time of the day in Python
A useful note when using Python for the first time in a while
The story of an error in PyOCR
The story of creating Botonyan that returns the contents of Google Docs in response to a specific keyword on Slack
Change the list in a for statement
How to save the feature point information of an image in a file and use it for matching
MongoDB for the first time in Python
The story of trying deep3d and losing
In creating a model for discriminating tweet emotions with LSTM + Embedding, I reaffirmed the importance of preprocessing in NLP.
The story of blackjack A processing (python)
[IOS] Change the display time for each frame of GIF animation in Pythonista3.
[Python] Create a list of date and time (datetime type) for a certain period
The story of creating (probably) the smallest skill that implements personalization and in-skill billing
The story of making a box that interconnects Pepper's AL Memory and MQTT
How to count the number of elements in Django and output to a template
The story of Django creating a library that might be a little more useful
Turn multiple lists with a for statement at the same time in Python
Get the stock price of a Japanese company with Python and make a graph
A collection of resources that may be useful for creating and expanding dotfiles
The story of low learning costs for Python
Get the caller of a function in Python
Make a histogram for the time being (matplotlib)
Make a copy of the list in Python
Find the number of days in a month
Read the output of subprocess.Popen in real time
A proposal for versioning of features in Kedro
Image processing? The story of starting Python for
The story of making a lie news generator
The story of finding the optimal n in N fist
The story of reading HSPICE data in Python
Visualized the usage status of the sink in the company
Output in the form of a python array