I'm sure that some of you haven't missed the "Google App Script".
Google Apps Script is a scripting language based on JavaScript that lets you do new and cool things with Google Apps like Docs, Sheets, and Forms. There's nothing to install — we give you a code editor right in your browser, and your scripts run on Google's servers. [1]
I have to admit that I didn't see the awesomeness of this system until a couple of days ago. At least it is really heplfull because it can of course do "cool things with Google Apps" but it can also be exposed as webapp and send Http requests.. So, yes, it can be used as a WebHook pipe.
A WebHook is an HTTP callback: an HTTP POST that occurs when something happens ; a simple event-notification via HTTP POST. .. A Pipe happens when your WebHook not oinly receives real-time data, but goes on to do something new and meaningful with it, triggering actions unrelated to the original events. [2]
Some of my projects are hosted on Bitbucket and built by Codeship. Both works great but there is no out of the box "build status" integration between Codeship and Bitbucket. There are some tentatives but they are not natively integrated into the Bitbcuket UI.
That's why I decided to build my own. I have used Google Apps Script to create a script who will receive the Codeship POST when a build status changes and call the Bitbcuket API to update the build status.
The idea is quite simple and the documentation is clear on both sides [3][4] and
fortunately Bitbucket API is usable with Basic auth (thanks god). But debugging
a Google Apps Script is not so easy and I took me a while to guess why this
"#$!&§" script was not working [5] . But at the end it is quite simple.
The script is available as Gist: gervaisb/CodeShip-Bitbucket-Build_status.js
Links :
- [1] Google Apps Script :
- [2] WebHooks.org :
- [3] Bitbbucket REST API Version 2 :
- [4] Codeship WebHooks :
- [5] Effective way to debug a Google Apps Script Web App on Stackoverflow :
Tags : [Codeship][Bitbucket][Google Apps Script][Integration]