{% extends "base.html" %}
|
|
{% load compress humanize staticfiles hc_extras %}
|
|
|
|
{% block title %}Add Webhook - {% site_name %}{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<h1>Webhook</h1>
|
|
|
|
<p>Webhooks are a simple way to notify an external system when a check
|
|
goes up or down. healthcheks.io will run a normal HTTP GET call to your
|
|
specified URL.</p>
|
|
<p>You can use the following variables in webhook URLs:</p>
|
|
<table class="table webhook-variables">
|
|
<tr>
|
|
<th class="variable-column">Variable</th>
|
|
<td>Will be replaced with…</td>
|
|
</tr>
|
|
<tr>
|
|
<th><code>$CODE</code></th>
|
|
<td>The UUID code of the check</td>
|
|
</tr>
|
|
<tr>
|
|
<th><code>$NAME</code></th>
|
|
<td>Urlencoded name of the check</td>
|
|
</tr>
|
|
<tr>
|
|
<th><code>$STATUS</code></th>
|
|
<td>Check's current status ("up" or "down")</td>
|
|
</tr>
|
|
<tr>
|
|
<th><code>$TAG1, $TAG2, …</code></th>
|
|
<td>Urlencoded value of the first tag, the second tag, …</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>For example, a callback URL using variables might look like so:
|
|
<pre>http://requestb.in/1hhct291?message=<strong>$NAME</strong>:<strong>$STATUS</strong></pre>
|
|
|
|
<p>
|
|
After encoding and replacing the variables, {% site_name %} would then call:
|
|
</p>
|
|
<pre>http://requestb.in/1hhct291?message=<strong>My%20Check</strong>:<strong>down</strong></pre>
|
|
|
|
<h2>Integration Settings</h2>
|
|
|
|
<form method="post" class="form-horizontal">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="kind" value="webhook" />
|
|
<div class="form-group {{ form.value_down.css_classes }}">
|
|
<label class="col-sm-2 control-label">URL for "down" events</label>
|
|
<div class="col-sm-10">
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="value_down"
|
|
placeholder="http://..."
|
|
value="{{ form.value_down.value|default:"" }}">
|
|
{% if form.value_down.errors %}
|
|
<div class="help-block">
|
|
{{ form.value_down.errors|join:"" }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group {{ form.value_up.css_classes }}">
|
|
<label class="col-sm-2 control-label">URL for "up" events</label>
|
|
<div class="col-sm-10">
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="value_up"
|
|
placeholder="http://..."
|
|
value="{{ form.value_up.value|default:"" }}">
|
|
{% if form.value_up.errors %}
|
|
<div class="help-block">
|
|
{{ form.value_up.errors|join:"" }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<button type="submit" class="btn btn-primary">Save Integration</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
{% compress js %}
|
|
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
|
|
<script src="{% static 'js/bootstrap.min.js' %}"></script>
|
|
{% endcompress %}
|
|
{% endblock %}
|