diff --git a/hc/api/models.py b/hc/api/models.py
index 40b9b76a..f4d9b37d 100644
--- a/hc/api/models.py
+++ b/hc/api/models.py
@@ -204,6 +204,9 @@ class Channel(models.Model):
"html": 1,
"priority": priority,
}
+ if priority == 2: # Emergency notification
+ payload["retry"] = settings.PUSHOVER_EMERGENCY_RETRY_DELAY
+ payload["expire"] = settings.PUSHOVER_EMERGENCY_EXPIRATION
url = "https://api.pushover.net/1/messages.json"
r = requests.post(url, data=payload, timeout=5)
diff --git a/hc/front/views.py b/hc/front/views.py
index a1485733..a56bfdfe 100644
--- a/hc/front/views.py
+++ b/hc/front/views.py
@@ -377,5 +377,9 @@ def add_pushover(request):
})
else:
- ctx = {"page": "channels"}
+ ctx = {
+ "page": "channels",
+ "po_retry_delay": td(seconds=settings.PUSHOVER_EMERGENCY_RETRY_DELAY),
+ "po_expiration": td(seconds=settings.PUSHOVER_EMERGENCY_EXPIRATION),
+ }
return render(request, "integrations/add_pushover.html", ctx)
diff --git a/hc/settings.py b/hc/settings.py
index 24301ed6..2e0b805a 100644
--- a/hc/settings.py
+++ b/hc/settings.py
@@ -128,6 +128,8 @@ EMAIL_BACKEND = "djmail.backends.default.EmailBackend"
# Pushover integration -- override these in local_settings
PUSHOVER_API_TOKEN = None
PUSHOVER_SUBSCRIPTION_URL = None
+PUSHOVER_EMERGENCY_RETRY_DELAY = 300
+PUSHOVER_EMERGENCY_EXPIRATION = 86400
try:
from .local_settings import *
diff --git a/templates/integrations/add_pushover.html b/templates/integrations/add_pushover.html
index 80bfd463..a2bb367b 100644
--- a/templates/integrations/add_pushover.html
+++ b/templates/integrations/add_pushover.html
@@ -26,6 +26,14 @@
+
@@ -47,4 +55,7 @@
{% endcompress %}
+
{% endblock %}