General Question about Webhooks

jouwstrab
New Contributor III

Can someone tell me what I'm doing wrong here:

#!/bin/bash

ROOM_ID='Room_ID'
AUTH_TOKEN='My_Auth_Token'
MESSAGE="Hello World"
curl -H "Content-Type: application/json" 
     -X POST 
     -d "{"color": "purple", "message_format": "text", "message": "$MESSAGE" }" 
     https://api.hipchat.com/v2/room/$ROOM_ID/notification?auth_token=$AUTH_TOKEN

That script works to update my HipChat room when executed. However, if I place the URL in Webhooks section of the JSS (see photo) nothing gets sent to the room. I'm wondering if anyone can tell me what I'm doing wrong, or what step I'm missing?ebffc5e54e754c5fb39cf1cca5936f0f

1 REPLY 1

BrysonTyrrell
Contributor II

Hey there Brett,

You won't be able to POST a Jamf webhook directly to a chat service like HipChat. HipChat is expecting a specific JSON format for data send to inbound webhooks, and you need to authenticate by passing your token as you have in your sample script.

There needs to be a "relay" service that sits between Jamf Pro and HipChat. Here's an example of what that all looks like:
Jamf Pro Integration Diagram

Your relay/integration needs to accept the webook POST from Jamf Pro, extract the details you want from the webhook data, format that into JSON for a HipChat message and the POST that using your API token to HipChat.

I have two Python examples using Flask that I can point you to which send webhook events to HipChat as notifications:

Patch Notification Example
https://github.com/brysontyrrell/Example-JSS-Webhooks/blob/master/HipChat-Patch-Notification/patch_n...

Casper-HC (Jamf Pro <-> HipChat Plugin)
https://github.com/jamfit/Casper-HC