Here at Nulab, we’re a global team working across different countries, cultures, and most importantly, languages. The two most popular languages we use are English and Japanese. While using different languages at work can be fun and challenging, it can also get frustrating copying and pasting between our Typetalk window and Google Translate all day.
That’s why we decided to create a translation bot using the Webhook feature in Typetalk and the Google Translates API. And now your team can too!
How to create a translation bot for Typetalk
- Get an API key from Google
We are using the Google Cloud Translation API. Google requires an API key to use the API, so we created the key on the Cloud Platform Console. You can refer to these Google Documents for getting an API key.
- Programming time!
We published a repository for the code we wrote for this bot. The code receives the Typetalk webhook data, calls the Google Translate API, and then posts a translated message to Typetalk.
You can clone the repository if you’d like, or create your own!
- Create a Typetalk bot in the topic you want to translate messages
This bot will receive posted messages, so be sure to check “Use Webhook” and input the receiving end-point URL.
In this case, Typetalk posts data to https://example.com/webhooks/google-translate as described in our Typetalk document.
- Post messages in the topic to test
After you deploy and run the code on your server, the bot will start to translate messages that users post in that topic. In this case, whenever a user posts a message in Japanese, it will automatically be translated into English by the bot.
If your test works, your translation bot is good to go! Now you and your team can swiftly translate messages back and forth with ease.