Webhooks
You can use our webhooks to fetch or store your Zenhub data, in real time, across services like Slack, Gitter, Spark, HipChat, or something custom!
To set up an integration, head on over to your Dashboard, navigate to your organization, and select the Slack & Integrations tab. From there, you may choose one of the 5 services (Slack, HipChat, Gitter, Spark, or Custom).
For instructions, you'll notice the How to create a webhook
link changes dynamically based on the service you select. Simply choose a repository with which to connect, add an optional description, paste your webhook, and click "Add" to save your new integration.
Custom webhooks
Our custom webhook sends a POST request to your webhook for multiple events that occur on your Zenhub board. See below for examples of the events and data that they will contain. Please note that the content type in the examples has been written in JSON, however the actual data is sent in x-www-form-urlencoded format.
Content Type: urlencoded
The POST request is sent in the x-www-form-urlencoded format.
Example:
field1=value1&field2=value2
Issue transfer
{
"type": "issue_transfer",
"github_url": "https://github.com/ZenHubIO/support/issues/618",
"organization": "ZenHubHQ",
"repo": "support",
"user_name": "ZenHubIO",
"issue_number": "618",
"issue_title": "Zenhub Change Log",
"to_pipeline_name": "New Issues",
"workspace_id": "603fc3e575de63001cc163f9",
"workspace_name": "My Workspace",
"from_pipeline_name": "Discussion"
}
Estimate Set
{
"type": "estimate_set",
"github_url": "https://github.com/ZenHubIO/support/issues/618",
"organization": "ZenHubHQ",
"repo": "support",
"user_name": "ZenHubIO",
"issue_number": "618",
"issue_title": "Zenhub Change Log",
"estimate": "8"
}
Estimate Cleared
{
"type": "estimate_cleared",
"github_url": "https://github.com/ZenHubIO/support/issues/618",
"organization": "ZenHubHQ",
"repo": "support",
"user_name": "ZenHubIO",
"issue_number": "618",
"issue_title": "Zenhub Change Log"
}
Issue Reprioritized
{
"type": "issue_reprioritized",
"github_url": "https://github.com/ZenHubIO/support/issues/618",
"organization": "ZenHubHQ",
"repo": "support",
"user_name": "ZenHubIO",
"issue_number": "618",
"issue_title": "Zenhub Change Log",
"to_pipeline_name": "Backlog",
"from_position": "4",
"to_position": "0",
"workspace_id": "603fc3e575de63001cc163f9",
"workspace_name" "My Workspace"
}
As an example, here's a simple Node/Express app that would be able receive the webhooks (using ngrok):
var express = require('express');
var http = require('http');
var bodyParser = require('body-parser');
var app = express();
http.createServer(app).listen('6000', function () {
console.log('Listening on 6000');
});
app.use(bodyParser());
app.post('*', function (req, res) {
console.dir(req.body);
});