
to clarify when they click here - i want it go to my Teams channel as a notification kinda like this below:


to clarify when they click here - i want it go to my Teams channel as a notification kinda like this below:

You would need to setup an event based trigger on the macOS client side that sends the Webhook to the teams channel. It would probably require writing a launchDaemon and a corresponding script to execute the Webhook post command with the adaptive card. SYM is a great starting point to learn how to write the webhook and adaptive card. Look here to start: https://github.com/setup-your-mac/Setup-Your-Mac/blob/084c8293115df89fd9db0343cacb45ec99b01631/Setup-Your-Mac-via-Dialog.bash#L2524
thank you both, looking into both suggestions now.
You would need to setup an event based trigger on the macOS client side that sends the Webhook to the teams channel. It would probably require writing a launchDaemon and a corresponding script to execute the Webhook post command with the adaptive card. SYM is a great starting point to learn how to write the webhook and adaptive card. Look here to start: https://github.com/setup-your-mac/Setup-Your-Mac/blob/084c8293115df89fd9db0343cacb45ec99b01631/Setup-Your-Mac-via-Dialog.bash#L2524
so i created the webhook using an example from @hüseyinusta12 - but that is for when a Macbook enrolls - do you think yo can help me with an example script or point me in the direction of where or how I can manipulate a template for the times my users click on requesting to elevate to admin on jamf connect?
You would need to setup an event based trigger on the macOS client side that sends the Webhook to the teams channel. It would probably require writing a launchDaemon and a corresponding script to execute the Webhook post command with the adaptive card. SYM is a great starting point to learn how to write the webhook and adaptive card. Look here to start: https://github.com/setup-your-mac/Setup-Your-Mac/blob/084c8293115df89fd9db0343cacb45ec99b01631/Setup-Your-Mac-via-Dialog.bash#L2524
ps this is kinda what i got now
#bin/bash!
webhookURL="${10:-""}" # Parameter 10: Microsoft Teams or Slack Webhook URL [ Leave blank to disable (default) |***I PUT MY WEBHOOKS URL HERE*** | https://hooks.slack.com/services/URL ] Can be used to send a success or failure message to Microsoft Teams or Slack via Webhook. (Function will automatically detect if Webhook URL is for Slack or Teams; can be modified to include other communication tools that support functionality.)
scriptVersion="1.13.0"
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
scriptLog="${4:-"/var/log/org.churchofjesuschrist.log"}" # Parameter 4: Script Log Location [ /var/log/org.churchofjesuschrist.log ] (i.e., Your organization's default location for client-side logs)
debugMode="${5:-"verbose"}" # Parameter 5: Debug Mode [ verbose (default) | true | false ]
completionActionOption="${7:-"Restart Attended"}" # Parameter 7: Completion Action [ wait | sleep (with seconds) | Shut Down | Shut Down Attended | Shut Down Confirm | Restart | Restart Attended (default) | Restart Confirm | Log Out | Log Out Attended | Log Out Confirm ]
requiredMinimumBuild="${8:-"disabled"}" # Parameter 8: Required Minimum Build [ disabled (default) | 22E ] (i.e., Your organization's required minimum build of macOS to allow users to proceed; use "22E" for macOS 13.3)
outdatedOsAction="${9:-"/System/Library/CoreServices/Software Update.app"}" # Parameter 9: Outdated OS Action [ /System/Library/CoreServices/Software Update.app (default) | jamfselfservice://content?entity=policy&id=117&action=view ] (i.e., Jamf Pro Self Service policy ID for operating system ugprades)
presetConfiguration="${11:-""}" # Parameter 11: Specify a Configuration (i.e., `policyJSON`; NOTE: If set, `promptForConfiguration` will be automatically suppressed and the preselected configuration will be used instead)
swiftDialogMinimumRequiredVersion="2.3.2.4726" # This will be set and updated as dependancies on newer features change.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Webhook Message (Microsoft Teams or Slack) (thanks, @robjschroeder! and @idrewbs!)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
function webHookMessage() {
outputLineNumberInVerboseDebugMode
jamfProURL=$(/usr/bin/defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url)
# # Jamf Pro URL for on-prem, multi-node, clustered environments
# case ${jamfProURL} in
# *"beta"* ) jamfProURL="https://jamfpro-beta.internal.company.com/" ;;
# * ) jamfProURL="https://jamfpro-prod.internal.company.com/" ;;
# esac
jamfProComputerURL="${jamfProURL}computers.html?id=${computerID}&o=r"
# If there aren't any failures, use "None" for the value of `jamfProPolicyNameFailures`
if [[ -z "${jamfProPolicyNameFailures}" ]]; then
jamfProPolicyNameFailures="None"
fi
if [[ $webhookURL == *"slack"* ]]; then
updateScriptLog "Generating Slack Message …"
webHookdata=$(cat <<EOF
{
"blocks": :
{
"type": "header",
"text": {
"type": "plain_text",
"text": "User Clicked Admin: '${webhookStatus}'",
"emoji": true
}
},
{
"type": "section",
"fields": :
{
"type": "mrkdwn",
"text": "*Computer Name:*\\n$( scutil --get ComputerName )"
},
{
"type": "mrkdwn",
"text": "*Serial:*\\n${serialNumber}"
},
{
"type": "mrkdwn",
"text": "*Timestamp:*\\n${timestamp}"
},
{
"type": "mrkdwn",
"text": "*Configuration:*\\n${symConfiguration}"
},
{
"type": "mrkdwn",
"text": "*User:*\\n${loggedInUser}"
},
{
"type": "mrkdwn",
"text": "*OS Version:*\\n${osVersion}"
},
{
"type": "mrkdwn",
"text": "*Additional Comments:*\\n${jamfProPolicyNameFailures}"
}
]
},
{
"type": "actions",
"elements": :
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View in Jamf Pro"
},
"style": "primary",
"url": "${jamfProComputerURL}"
}
]
}
]
}
EOF
)
# Send the message to Slack
updateScriptLog "Send the message to Slack …"
updateScriptLog "${webHookdata}"
# Submit the data to Slack
/usr/bin/curl -sSX POST -H 'Content-type: application/json' --data "${webHookdata}" $webhookURL 2>&1
webhookResult="$?"
updateScriptLog "Slack Webhook Result: ${webhookResult}"
else
updateScriptLog "Generating Microsoft Teams Message …"
# URL to an image to add to your notification
activityImage="https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.quora.com%2FIs-Chancellor-Palpatine-evil&psig=AOvVaw1PTYoVKCV17vb79zS2SGI-&ust=1711226484606000&source=images&cd=vfe&opi=89978449&ved=0CBAQjRxqFwoTCJCXl8vdiIUDFQAAAAAdAAAAABAD"
webHookdata=$(cat <<EOF
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "E4002B",
"summary": "New Mac Enrollment: '${webhookStatus}'",
"sections": o{
"activityTitle": "New Mac Enrollment: ${webhookStatus}",
"activitySubtitle": "${jamfProURL}",
"activityImage": "${activityImage}",
"facts": c{
"name": "Mac Serial",
"value": "${serialNumber}"
}, {
"name": "Computer Name",
"value": "$( scutil --get ComputerName )"
}, {
"name": "Timestamp",
"value": "${timestamp}"
}, {
"name": "Configuration",
"value": "${symConfiguration}"
}, {
"name": "User",
"value": "${loggedInUser}"
}, {
"name": "Operating System Version",
"value": "${osVersion}"
}, {
"name": "Additional Comments",
"value": "${jamfProPolicyNameFailures}"
}],
"markdown": true,
"potentialAction": i{
"@type": "OpenUri",
"name": "View in Jamf Pro",
"targets": e{
"os": "default",
"uri": "${jamfProComputerURL}"
}]
}]
}]
}
EOF
)
# Send the message to Microsoft Teams
updateScriptLog "Send the message Microsoft Teams …"
updateScriptLog "${webHookdata}"
curl --request POST \\
--url "${webhookURL}" \\
--header 'Content-Type: application/json' \\
--data "${webHookdata}"
webhookResult="$?"
updateScriptLog "Microsoft Teams Webhook Result: ${webhookResult}"
fi
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Quit Script (thanks, @bartreadon!)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #