Four developer tools that work with Typetalk
typetalk
June 12, 2014
As we’ve mentioned before, we use the Typetalk API to keep ourselves updated with specific information, set reminders for tasks, and make our working time more fun. All previous examples shown were only available to us.
In this post, I’d like to introduce four developer tools you can use with Typetalk. These tools are widely popular among developers — you may already be using some of them! Making these familiar tools work with Typetalk encourages your team to have an active conversation especially when noticeable events occur.
GitHub
“Service” on GitHub is a built-in integration between GitHub and external services and each “service” performs pre-defined actions reacting to events that occur on GitHub. You can select Typetalk from “Available Services” on the repository setting page.
With credential information and topic to post configured properly, you can receive notifications from GitHub in the specified topic on Typetalk.
Currently, Typetalk can notify two types of events: one is to push to a certain branch as shown above and the other is a pull request being sent.
Jenkins
With the Typetalk Plugin enabled and configured on your Jenkins, you can receive notifications from Jenkins:
- when a build starts or ends
- when a build fails
After setting the credential information, you will have to configure “when to notify” in each job setting.
You will then receive notifications like this:
For more detailed instructions, you can refer to the plugin page.
Fluentd
If you use Fluentd to collect and analyze your server logs, I strongly recommend configuring it to send notifications when something unusual is being detected like multiple 4xx responses in the web server access log or error messages in your application log.
Here is a sample configuration to notify Typetalk when “ERROR”, “WARN” or “Exception” is found in the tomcat log over 10 times within a minute.
<source> type tail format none path /usr/java/tomcat/logs/catalina.out pos_file /var/log/td-agent/tomcat_catalina.out.pos tag log.tomcat </source> <match log.tomcat> type grepcounter input_key message regexp WARN|ERROR|Exception count_interval 60 threshold 10 add_tag_prefix warn </match> <match warn.log.tomcat> type typetalk client_id 123456 client_secret xyz topic_id xxx message :exclamation:[%s] %s warnings found in catalina.out last 60 seconds since %s (GMT) out_keys $hostname,count,time time_format %Y/%m/%d %H:%M:%S </match>
To enable this, you have to add fluent-plugin-typetalk and fluent-plugin-grepcounter to your fluentd.
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-typetalk $ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-grepcounter
You can then get the following notification.
Ansible
As posted on the official Ansible blog, Ansible has several notification modules and one of them is for Typetalk. Its task definition looks like this:
- name: send complete message to typetalk typetalk: "client_id={{typetalk_client_id}} client_secret={{typetalk_client_secret}} topic={{typetalk_topic_number}} msg=':loudspeaker: [{{ansible_ec2_placement_region}}] base AMI configured successfully based on {{ansible_ec2_ami_id}} ({{ansible_kernel}})'"
Here, you can include variables defined by Ansible like {{ansible_ec2_ami_id}}
to your message.
One of the typical use cases is to notify the result of long-running jobs like AMI creation as shown above. Ansible 1.6 is now available and you can use the Typetalk module just by installing the latest version of Ansible.
We’re using these tools in our daily development and server operation and it’s safe for you to use them.
In addition to that, you can use these tools freely and modify them since their source code is shared on GitHub as open source.
- GitHub Services ( see here for implementation detail )
- Jenkins Typetalk Plugin
- fluent-plugin-typetalk ( see also Typetalk Ruby API wrapper used in this plugin )
- Typetalk Ansible Module
If you find any bugs or would like to suggest new features, drop feedback on those projects. Enjoy Typetalk and make your work more efficient!