diff --git a/back/pialert.py b/back/pialert.py index b318b6ad..63631e41 100644 --- a/back/pialert.py +++ b/back/pialert.py @@ -1608,6 +1608,12 @@ def send_webhook (_json, _html): except NameError: # variable not defined, use a default webhookPayload = 'json' + # HTTP request method (GET, POST...) + try: + webhookRequestMethod = WEBHOOK_REQUEST_METHOD + except NameError: # variable not defined, use a default + webhookRequestMethod = 'GET' + # use data type based on specified payload type if webhookPayload == 'json': payloadData = _json @@ -1631,7 +1637,7 @@ def send_webhook (_json, _html): curlParams = ["curl","-i","-H", "Content-Type:application/json" ,"-d", json.dumps(_json_payload), _WEBHOOK_URL] else: _WEBHOOK_URL = WEBHOOK_URL - curlParams = ["curl","-i","-X", "GET" ,"-H", "Content-Type:application/json" ,"-d", json.dumps(_json_payload), _WEBHOOK_URL] + curlParams = ["curl","-i","-X", webhookRequestMethod ,"-H", "Content-Type:application/json" ,"-d", json.dumps(_json_payload), _WEBHOOK_URL] # execute CURL call p = subprocess.Popen(curlParams, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) diff --git a/config/pialert.conf b/config/pialert.conf index 0f997090..5be6f6d3 100644 --- a/config/pialert.conf +++ b/config/pialert.conf @@ -39,6 +39,7 @@ WEBHOOK_URL = 'http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa # supported values: 'json' or 'html' # e.g.: for discord use 'html' WEBHOOK_PAYLOAD = 'json' +WEBHOOK_REQUEST_METHOD = 'GET' # POST, GET... # Apprise settings #-----------------------