david7
July 11, 2025, 12:56am
1
Hello,
I'm trying to trigger a webhook on a Unifi Alarm Manager to open a gate. Unifi requires a HTTP Post header request to authenticate. Does anyone know how to send header info using Hubitat's HTTP Post?
Here's a curl example:
curl -k -X GET 'https://YOUR_CONSOLE_IP/proxy/network/integration/v1/sites'
-H 'X-API-KEY: YOUR_API_KEY'
-H 'Accept: application/json'
if youre into writing your own app you are looking for httpPost or asynchttpPost. webcore from my understanding can also do this, but i do not have personal experence with it. I know RM currently can not do this.
david7
July 11, 2025, 1:08pm
3
Hi @sidjohn1 . I don't know how to write apps. I was hoping for some built-in options.
I don't know about Rule Machine, but you can certainly do it in Webcore, a built-in app.
1 Like
david7
January 29, 2026, 5:52pm
5
I finally figured out how to do this. Here's a driver for those wanting Hubitat to Unifi Protect webhook triggers:
metadata {
definition(
name: "Unifi Protect Webhook Trigger",
namespace: "unifi-protect-webhook-trigger",
author: "David Trautman"
) {
capability "Switch"
}
preferences {
input name: "triggerLink",
type: "string",
title: "Trigger link",
required: true,
defaultValue: ""
input name: "apiKey",
type: "string",
title: "Protect API key",
required: true,
defaultValue: ""
}
}
def on() {
def params = [
uri: "${triggerLink}",
headers: [
"X-API-KEY": "${apiKey}",
"Accept": " application/json"
],
ignoreSSLIssues: true
]
try {
httpPost(params) {
resp ->
options = resp.data
}
} catch (e) {
log.error "$e - Post Params: $params"
}
}
Nice! I use asynchttpGet to send data to google sheets. I moved on from Webcore a few years ago, and I now code all automations in Groovy.
def sendLog(tab,params) {
sendEvent(name: "tab", value: tab)
sendEvent(name: "params", value: params)
def googleUri = device.currentValue("googleUri") + tab + "&" + params
googleUri = googleUri.replace(" ","%20")
logDebug("Send Uri is ${googleUri}",3)
def getParams = [
uri: googleUri,
requestContentType: 'application/json',
contentType: 'application/json',
headers: ['CustomHeader':'CustomHeaderValue'],
]
asynchttpGet('logCallbackMethod', getParams, [dataitem1: "datavalue1"])
}